shinyscorpion / task_bunny

TaskBunny is a background processing application written in Elixir and uses RabbitMQ as a messaging backend
MIT License
202 stars 30 forks source link

Fix enqueue! typespec #50

Closed indrekj closed 6 years ago

indrekj commented 6 years ago

It seems that dialyzer is not checking this typespec. Its probably related to macros but I'm not entirely sure. TaskBunny.Job.enqueue! spec clearly says that only return value is :ok.

This was discovered when using this library in an application:

lib/transporter/delivery_requests/delivery_job.ex:5: The specification
for 'Elixir.Transporter.DeliveryRequests.DeliveryJob':'enqueue!'/2
  states that the function might also return {'error',_} but the
  inferred return is 'ok'
ono commented 6 years ago

Oh, sorry, didn't notice the PR until now. Good spot but enqueue! would never return {:error, any}.

I guess we need to remove | {:error, any} from..

https://github.com/shinyscorpion/task_bunny/blob/master/lib/task_bunny/job.ex#L199

Would you mind update the PR? Or I will do it sometime soon.

indrekj commented 6 years ago

updated

ono commented 6 years ago

Awesome. Thank you!