Michael Graziano wrote: > The "quick fix" would seem to be scheduling a cron job that sends a query > like this to the InterMapper database: > > DELETE FROM event WHERE end_time < now() - '30 days'::interval CASCADE; >
Unfortunately it's not that simple, because IMDatabase caches some event information in memory to improve performance. If you directly delete from the database, the cached data may become invalid, leading to import errors. What you could do is take advantage of the fact that the database automatically refreshes its caches whenever IM restarts. So you could have the cron job stop the IM server(s) reporting to the database, run the query, then start the IM server(s) again. But that isn't perfect either, since it leaves a small gap in monitoring, and may trigger alerts and other undesirable behavior as a result of the restart. Approaching it another way, if the cron job ran the query and then immediately restarted IMDC, that would also reload the caches, though it still leaves a small window in which it's possible to get import errors. The only fully reliable solution is to write a script that issues an HTTP POST to run the delete-old-events action on the maintenance page, but even that is very much a work-around, not a permanent solution. David ----------- David Schnur Dartware, LLC -------------------- m2f -------------------- Read this topic online here: http://forums.intermapper.com/viewtopic.php?p=4109#4109 ____________________________________________________________________ List archives: http://www.mail-archive.com/intermapper-talk%40list.dartware.com/ To unsubscribe: send email to: [email protected]
