Replies: 2 comments
-
Digging a little more into the code I can see there is tests for |
Beta Was this translation helpful? Give feedback.
-
Noticed v2 always enqueues jobs for sending. I don't know if we'll support inline executions because they will slow down your requests. If you don't set a delay, the emails will be sent basically immediately in your background workers. For example, Sidekiq might have your email sent before the HTTP request finishes. You can use the |
Beta Was this translation helpful? Give feedback.
-
Hi @excid3 and all!
I am really enjoying working with the gem, thanks for all the hard work 💪
I am trying to understand if I can create a notification and send it right now by not going on the
ActiveJob
queue, but rather sending inline? Kind of akin toSomeSidekiqJob.perform_sync
vsSomeSidekiqJob.perform_async
.Some code:
By wrapping in the transaction, if there was any error in the saving of the user, or the sending of the notification, then everything inside the transaction would not be committed to the db (ofc) but I would also not want the notification to be sent (or queued to be sent!)
From what I can see this behaviour does not currently exist, with the main indication of this being the
:deliver
method!noticed/app/models/concerns/noticed/deliverable.rb
Lines 112 to 113 in 1514ae3
If I set
enqueue_job: false
, then the the notification will not be enqueued and I will not have any notification send iiuc?Ideally some sort of
UserNotifier.with(message: "Hello world").deliver(user, deliver_now: true)
would be the API which could be used in this case.Happy to open a PR but this could be a deviation away from your direction with the gem.
Many thanks!
Beta Was this translation helpful? Give feedback.
All reactions