Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Hack to fix hanging on locked .mh_sequences

  • Loading branch information...
commit d55507f00ef71f1ba284d3a537a89a84bf252860 1 parent 406118d
@dagbrown authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 gurgitate/deliver/mh.RB
View
16 gurgitate/deliver/mh.RB
@@ -62,7 +62,8 @@ module Gurgitate
def update_sequences mailbox, msgnum
sequences = File.join(mailbox, ".mh_sequences")
lockfile = sequences + ".lock" # how quaint
- loop do
+ counter=0
+ while counter < 10 do
begin
File.open(lockfile,
File::WRONLY |
@@ -86,14 +87,23 @@ module Gurgitate
end
end
- File.unlink(lockfile)
+ File.unlink lockfile
break
rescue Errno::EEXIST
# some other process is doing something, so wait a few
# milliseconds until it's done
- sleep(0.01)
+ counter += 1
+ sleep(0.1)
end
end
+
+ # If it's still around after 10 tries, then obviously
+ # something bigger went wrong; forcibly remove it and
+ # try again.
+ if counter == 10 then
+ File.unlink lockfile
+ update_sequences mailbox, msgnum
+ end
end
def update_unseen unseen, msgnum
Please sign in to comment.
Something went wrong with that request. Please try again.