Comment 1 for bug 1017904

Revision history for this message
Ivan Sagalaev (isagalaev) wrote :

Hi Dominique,

Distribution tasks are grouped not by a subscriber callback URL alone but by a pair of (callback, topic). The purpose of it is to group together several new entries of one topic intended for a single subscriber. This is merely a network optimization and it doesn't influence the design of a subscriber. It can either have a separate callback URL for different topics or have a single URL and determine the topic from <link rel="self"> in the AtomPub payload (or infer it from any other metadata in the system). Anyway, SubHub won't send entries from different topics in one payload.

As for the new entries, yes, SubHub indeed doesn't keep track of the latest published entry itself. Instead, the user is supposed to call `subhub.publish()` for every new entry, usually right at the time when it's created. This call is not cheap, though, as it is immediately tries to process all the distribution tasks in a blocked fashion. If you don't want to block for distribution then instead of calling `subhub.publish()` you can just add a new distribution task:

    DistributionTask.objects.add(topic, entry_id)

… and then send a signal to some separate process that would call `manage.py subhub_maintenance --distribute` from the shell or `DistributionTask.objects.process()` directly if it's a Python environment.