cvsuser 03/10/30 08:43:14
Modified: App-Context/lib/App/ResourceLocker IPCLocker.pm
Log:
retry rather than fail when contacting the lock daemon
Revision Changes Path
1.2 +17 -2 p5ee/App-Context/lib/App/ResourceLocker/IPCLocker.pm
Index: IPCLocker.pm
===================================================================
RCS file: /cvs/public/p5ee/App-Context/lib/App/ResourceLocker/IPCLocker.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -r1.1 -r1.2
--- IPCLocker.pm 7 Oct 2002 21:55:58 -0000 1.1
+++ IPCLocker.pm 30 Oct 2003 16:43:14 -0000 1.2
@@ -1,6 +1,6 @@
#############################################################################
-## $Id: IPCLocker.pm,v 1.1 2002/10/07 21:55:58 spadkins Exp $
+## $Id: IPCLocker.pm,v 1.2 2003/10/30 16:43:14 spadkins Exp $
#############################################################################
package App::ResourceLocker::IPCLocker;
@@ -179,7 +179,22 @@
#push(@params, "user", $self->{context}->user());
push(@params, "block", ($args->{nonBlocking} ? 0 : 1));
+ $lock = "";
+ my $failures = 0;
+ while (!$lock) {
+ eval {
$lock = IPC::Locker->lock(@params);
+ };
+ if ($@) {
+ $failures++;
+ if ($failures % 10 == 1) {
+ print STDERR "lock failed $failures times: [EMAIL PROTECTED]";
+ print STDERR " {", join(",",@params), "}\n";
+ }
+ sleep(6);
+ }
+ }
+
$resource_name = $lock->lock_name();
if (defined $resource_name) {