Just letting you know...

Posted On: Tue, 2008-06-03 21:54 by sitapati

After the recent JAOO developer conference I had a chance to write two lines of code, something that I haven't done in a few years.

We're going away next week for six days for a holiday. We have one every three or four years. The last one was when we came back from Peru in 2004. Anyways, I may not have internet access, so I can't be molly coddling the Planet ISKCON server and code.

I spent some time tuning the Apache instance so that the server doesn't run out of memory and go into swap death (you've noticed that it sometimes disappears?).

I also modified the Planet code to make it more robust. You've noticed that Planet ISKCON will sometimes not update for a few hours, up to a day? It's because a cache file somehow becomes corrupted. Each feed has a cache, so that Planet doesn't have to download the content every hour, just the new stuff. When a feed's cache file becomes corrupted, it chokes the whole job. When that happens, at to this point, I manually run the cron job, identify the culprit from the stack trace, and delete the cache file by hand.

Now what I did was identify the call that opens the cache file, and put it in a try...except block that will delete the cache file on a failure, and retry:

__init__.py:

        cache_filename = cache.filename(planet.cache_directory, url)
        try:        
	    cache_file = dbhash.open(cache_filename, "c", 0666)
        except:
            os.remove(cache_filename)
            cache_file = dbhash.open(cache_filename, "c", 0666)   

If the second call fails, it will still bomb out - but this will make it more robust.

( categories: )

Sita-pati das

Sitapati on Facebook

Mission

jani va na jani, kari apana-sodhana

  1. "Whether I realize it or not, it is for self-purification that I write this blog."


The Sitapati Project


The%20Sitapati%20Project
Quantcast

Recent comments

Syndicate via RSS





Navigation

User login