Skip to content

Instantly share code, notes, and snippets.

@chartjes
Created January 20, 2012 16:56
Show Gist options
  • Save chartjes/1648373 to your computer and use it in GitHub Desktop.
Save chartjes/1648373 to your computer and use it in GitHub Desktop.
Real-time notifications from a task worker
I am using Gearman to import content from a 3rd party via their API. I need the ability to notify users IN REAL TIME that an import of a specific item has failed or been blocked (we only accept MP3's and need to block video imports) or that the Gearman job itself has crashed (there is sometimes wonkiness with MySql deciding it needs to 'go away').
Thoughts and suggestions on how to accomplish this task would be greatly appreciated.
@EliW
Copy link

EliW commented Jan 20, 2012

chartjes. Typically I would (and have) handled this via a polling system. Regardless of how you want to handle the notifications (stick them in memcached, use a message queue (SQS, Rabbit, etc), write it to a file, whatever) ...

And just write a little javascript on the client side, that keeps hitting every second or two, an endpoint that checks for the message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment