Complete.Org: Mailing Lists: Archives: offlineimap: November 2002:
Network retry
Home

Network retry

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: offlineimap@xxxxxxxxxxxx
Subject: Network retry
From: Jared Rhine <jared@xxxxxxxxxxx>
Date: Sat, 16 Nov 2002 14:46:17 -0800

[Martijn == mj@xxxxxxxx on Thu, 14 Nov 2002 17:27:31 -0500]

Martijn> My preferred way is running offlineimap in the background
Martijn> using a cron job, every couple of minutes. If it couldn't
Martijn> connect, it'll try again later.

What if the last one is still running?  Can offlineimap experience
corruption in this case?

John> https://bugs.complete.org/Ticket/Display.html?id=9

Arg; gotta admit, I wish RT had an "anonymous browsing" mode.

John> 1. Network problems during a sync
John> 2. Network problems between syncs

John> If your problem is mostly #2, I would suggest using
John> holdconnectionopen = no in your ~/.offlineimaprc.  That way, for
John> each scheduled sync, OfflineIMAP will open new connections and
John> then close them.

As you can guess, I can't really control when the network errors come,
so I'm likely to experience both.  I was running 'holdconnectionopen =
yes' though, so that's been adjusted.

John> I have chosen to make OfflineIMAP resiliant in the face of a
John> crash...

And please never do anything to change that :)

I thought it might be straightforward to just kill the current
connection and try again later.  If it's not, ok.

I find myself thinking of offlineimap like a daemon.  I expect it to
run 24/7, it's in my "process check" configuration, etc, etc.  It
doesn't quite behave like a standard one so it looks like external
wrapper is probably the best route to take to modify the overall
system behavior.

Seems like basic requirements for an offlineimap wrapper are:

  - Allows offlineimap to run frequently (as little as every minute if
    someone's into that)
  - Restarts offlineimap if it dies
  - Logs errors output by offlineimap
  - Avoids running more than one instance of offlineimap at a time

Cron will do all except that last.  If the last is a requirement, then
there's three options off the top of my head:

  - Have offlineimap keep itself from running more than one
    simultaneous instance and just invoke from cron.

  - A wrapper which execs ARGV iff there's not a lock on the program.
    (Easiest implementation is just to write a lock file with the name
    of ARGV[0] and exit if the file exists, but you can get more
    sophisticated; I've written this code before, should be easy to
    generalize).  Run the wrapper from cron.

  - A long-running daemon which launches offlineimap, restarts if
    it dies, and logs the errors.  Perhaps daemontools.

Again, doing this stuff outside offlineimap is probably the better way
to go, but I wanted to take the thought process methodologically and
openly, as it relates to the evolution of the offlineimap solution
itself.

-- jared@xxxxxxxxxxx

"Tiger gotta hunt.  Bird gotta fly.
 Man gotta sit and wonder why, why, why.
 Tiger gotta sleep.  Bird gotta land.
 Man gotta tell himself he understand." -- Kurt Vonnegut Jr.


[Prev in Thread] Current Thread [Next in Thread]