acutario / ravenx

Notification dispatch library for Elixir applications
MIT License
110 stars 8 forks source link

Allow unlinked notifications #34

Closed crbelaus closed 7 years ago

crbelaus commented 7 years ago

Dispatching async notifications with Ravenx currently ties the notification dispatcher process with the caller. This allows the caller to receive the notification dispatch result, but also errors if the notification dispatcher process crashes.

In some cases we may have notifications that can be dispatched without an interest on their result. Currently Ravenx does not support this behaviour.

I've implemented a new dispatch_nolink function for notifications. This function starts an unlinked Task for dispatching the notification and allows the caller to completely ignore the notification result. The docs have been updated accordingly.

While doing this I've found some repetition in the Ravenx.Notification.dispatch_notification/1 and Ravenx.Notification.dispatch_async_notification/1 (I was going to implement Ravenx.Notification.dispatch_nolink_notification/1), so I've refactored them into a single Ravenx.Notification.dispatch_notification/2 function.