I have lib/my_app
as generated by Phoenix, and then I also created my own lib/quickbooks_sync_cache
OTP app to manage Quickbooks syncing.
I spawn QuickbooksSyncCache.SycnWorker
genserver processes to sync some data from my main app to Quickbooks. During the worker processes’s lifespan, it’ll map over entities and post them to Quickbooks, once the post is finished, it’ll fire an Endpoint.broadcast!("companies:1", "qb_sync_progress", newly_synced_item)
to let a channel in my main app know that an item was synced.
Once the worker process is done its job, it’s supervisor will terminate it (this is important).
The weird thing is that if I intercept["qb_sync_progress"]
and provide my own custom handle_out
function, the handle_out
will not receive any messages until the worker process who broadcasted them has been terminated.
However, if I dont intercept the handle_out
, everything works exactly fine and on time.
I have no idea what’s happening here… Could someone more experienced than I elaborate for me? I’d much appreciate the help