Currently, Push Hub supports 2 notification mechanisms:

1) Immediate via Batch API. This only works if you're operating in a GUI.
2) Delayed via Cron/Queue. This is the only option if you're operating in a scripted process.

I'm operating in a scripted process, and need to send low-volume, low-latency pushes. That is, there's only 1-2 subscribers for a given feed but they need updates immediately, not in a few minutes/hours when cron_queue gets around to it.

By way of a solution, this patch changes how push_hub_notify() works. Instead of a boolean batch/queue, it switches to a bit mask with 3 options: batch, cron, and immediate (to be combined with cron). There's also code to handle most backward-compatible cases for those still using boolean True/False.

The way "immediate" works is simply that if you are using the queue, then in hook_exit() we churn through the push queue once. That doesn't guarantee that messages are send immediately, but it does mean that we'll send as many as we can immediately. If you're dealing in a low-volume environment, like I am, then in practice they should all be effectively immediate.

CommentFileSizeAuthor
#1 1421758-immediate-push.patch4.08 KBCrell
immediate-push.patch4.68 KBCrell

Comments

Crell’s picture

Status: Needs review » Fixed
StatusFileSize
new4.08 KB

Here's an updated version, which is properly tested and uses a shutdown function instead of hook_exit(). That is a little more performant in the typical case.

I have committed this to 7.x-1.x and pushed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.