For now, here's what "rake sources:update" does:
- Whenever it's run, it retrieves all sources where the "reimport" flag
is set (I think there are about half a dozen in the production database
now) and the "next_update" date has passed.
- For each of these sources:
- It's queried, and abstract events are built.
- A new Update model is created; its "status" attribute gets a message
containing either a count of created abstract events, or the exception
that occurred when we tried.
- The source's next_update time is set for two days from now.
- It discards any Update entries older than two weeks.
There's also "rake sources:prime" (which sets all the 'reimport' sources
to be due for updating) and "rake sources:status" that shows each
source, its most recent update status, and its next_update time.
The idea was:
- Anyone can run it locally for testing
- Anyone who wants to see what's been happening
- It can get run in production as a cron task - hourly's probably fine.
(As a cron task, instead of a long-running service, we don't need to
worry about long-term memory buildup, and we can tweak its behavior by
committing source changes without needing to restart the service.)
What it doesn't do? Actually update or import any events -- that comes
next.
So: can someone please set up a cron job in production, then do
"RAILS_ENV=production rake sources:prime"?
Thanks,
...Bryan
-igal
-igal