On Thu, Jan 06, 2005 at 02:27:07PM -0800, Peter Karman wrote:
> I've run into this before with SWISH::API and am now reminded [again]
> that I need to do something about it. but what?
> the issue is:
> I've got an open SWISH::API handle tied to an index, and the index
> changes. Typically this is when a cron job creates a new index and
> renames it to the existing index. My running app will hang indefinitely,
> ostensibly because it is tied to a file that no longer "exists" (or at
> least, has changed in content).
If the file is open then I would think it would still read the old
file (even after it was deleted).
I've got some code where I write to an open log file. Same deal -- a
cron job can rotate the log and I need to detect this so I'll close
the old log and open a new one.
I perl what I do is this: Say my open file handle is LOG, but the
file name is $logfile;
my @handle_stat = stat( LOG );
my @file_stat = stat( $logfile );
then I check:
"@handle_stat[0,1]" eq "@file_stat[0,1]"
And if they don't match then I
open LOG, $logfile
Now, I don't think there's currently a way to get the index file
handle via the API.
You could in your code stat the index file(s) before connecting then
in your code compare the stat() at each request. If they do not match
then close the existing index and reopen.
Unsubscribe from or help with the swish-e list:
Help with Swish-e:
Received on Thu Jan 6 14:40:35 2005