Closed tmaszk closed 7 years ago
@tmaszk I am unable to replicate this.
Using elixir 1.4:
akira@Alexs-MacBook-Pro ~/development/erlang/exq (master) $ elixir --version
Erlang/OTP 18 [erts-7.3] [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]
Elixir 1.4.0
iex(2)> defmodule Worker do
...(2)> def perform do
...(2)> IO.puts "Did it"
...(2)> end
...(2)> end
{:module, Worker,
<<70, 79, 82, 49, 0, 0, 5, 12, 66, 69, 65, 77, 69, 120, 68, 99, 0, 0, 0, 130,
131, 104, 2, 100, 0, 14, 101, 108, 105, 120, 105, 114, 95, 100, 111, 99, 115,
95, 118, 49, 108, 0, 0, 0, 4, 104, 2, ...>>, {:perform, 0}}
iex(3)> Exq.enqueue(Exq, "default", Worker, [])
{:ok, "9a8989d7-6812-499d-8e85-392fd8042d10"}
iex(4)>
2017-02-09 19:34:08.064 [info]: Elixir.Worker[9a8989d7-6812-499d-8e85-392fd8042d10] start
Did it
2017-02-09 19:34:08.065 [info]: Elixir.Worker[9a8989d7-6812-499d-8e85-392fd8042d10] done: 794µs sec
Are you sure that the worker module is loaded correctly? If so can you paste your mix.lock file.
@tmaszk looks like a dependency issue, I can take a look. If you can post your mix.lock
file to see what you're using that could also help.
@tmaszk can you try against the latest master?
@akira I retested with the latest master and confirmed that the issue is fixed. Thanks for the quick response.
I seem to be running into the same type of issue with encoding structs. I'm using an up to date version of the app (tried master) as well as poison (2.0). I'm on Elixir 1.4 but I don't know if that has anything to do with it. If you have any ideas @akira I would greatly appreciate it. Thanks!
@drapergeek can you post more info on your exact error and which versions of the other stuff are you running. I can't seem to reproduce even with Elixir 1.4 and different versions of Poison.
Certainly!
The error:
** (Poison.EncodeError) unable to encode value: {:sub_area, "tac"}
(poison) lib/poison/encoder.ex:354: Poison.Encoder.Any.encode/2
(poison) lib/poison/encoder.ex:232: anonymous fn/3 in Poison.Encoder.List.encode/3
(poison) lib/poison/encoder.ex:233: Poison.Encoder.List."-encode/3-lists^foldr/2-1-"/3
(poison) lib/poison/encoder.ex:233: Poison.Encoder.List.encode/3
(poison) lib/poison/encoder.ex:232: anonymous fn/3 in Poison.Encoder.List.encode/3
(poison) lib/poison/encoder.ex:233: Poison.Encoder.List."-encode/3-lists^foldr/2-1-"/3
(poison) lib/poison/encoder.ex:233: Poison.Encoder.List.encode/3
(poison) lib/poison/encoder.ex:213: anonymous fn/4 in Poison.Encoder.Map.encode/3
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map."-encode/3-lists^foldl/2-0-"/3
(poison) lib/poison/encoder.ex:214: Poison.Encoder.Map.encode/3
(poison) lib/poison.ex:41: Poison.encode!/2
(exq) lib/exq/redis/job_queue.ex:366: Exq.Redis.JobQueue.to_job_serialized/5
(exq) lib/exq/redis/job_queue.ex:22: Exq.Redis.JobQueue.enqueue/6
(exq) lib/exq/enqueuer/server.ex:39: Exq.Enqueuer.Server.handle_cast/2
(stdlib) gen_server.erl:601: :gen_server.try_dispatch/4
(stdlib) gen_server.erl:667: :gen_server.handle_msg/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", {:enqueue, {#PID<0.587.0>, #Reference<0.0.3.5889>}, "craigslist", Joydrive.Craigslist, [%Vehicle{deals: #Ecto.Association.NotLoaded<association :deals is not loaded>, exterior_options: [], safety_options: [], cargo_options: [], updated_at: #<DateTime(2017-
Poison: 2.2 and Elixir 1.4
Any other info I can provide to be helpful?
@drapergeek This parameter is not coming from Exq, is this something you're sending as a worker parameter?
> Poison.encode!({:sub_area, "tac"})
** (Poison.EncodeError) unable to encode value: {:sub_area, "tac"}
lib/poison/encoder.ex:383: Poison.Encoder.Any.encode/2
lib/poison.ex:41: Poison.encode!/2
You can send this this as a list and it should work:
> Poison.encode!([:sub_area, "tac"])
"[\"sub_area\",\"tac\"]"
I'm upgrading my project to Elixir 1.4, but Exq doesn't seem to work properly. I recreated the problem with a fresh project and received the same results.
Steps to reproduce:
mix new exqtest
{:exq, "~> 0.8.3"}
to deps in mix.exs, and runmix deps.get
iex -S mix
Exq.enqueue(Exq, "default", Worker, [])