Originally posted on Trac by gaspard Original Trac Ticket
Description
Cached pages do not consider passing time (future publish_from
dates). If we create a page in a project, the project might be
cached and when the time comes for the page to be live publish_from
, the project's cache will be served by apache and the new page
will not show up.
Possible solutions
Fix the time to live of the cache to the minimum of it's "to be
published" pages' publication date.
Create a table with scheduled events:
trigger_at when the event should run
event what to do
site_id site reference
With this in place, we need a cron job to check pending actions
and when we publish with a publication time in the future, this
happens:
Publish with publish_from = in 2 hours (same rights as
publication needed).
- The only effect is that the version's status becomes
ReadyToPublish? (45). Update 'trigger_at' for the event 'publish'
for the given site.
- Every 1 (5?) minutes, a cron job checks the database for events
to trigger. If it finds something, it calls curl with an url like
'/heartbeat' (can only be called from localhost).
- When 'heartbeat' is called (we are inside running mongrel), the
node is actually published by (super user ? version owner ? node
owner ?).
- Doing a find for versions with status 45 in the current site,
the 'publish' entry is either removed or updated.
- That's it
Reference: #10 Time to live defined in templates..