Sha256: 339c55171bd1d81b45464ffa8df9d16e0eb4594d1ce7bb624431fa956eda379e
Contents?: true
Size: 479 Bytes
Versions: 5
Compression:
Stored size: 479 Bytes
Contents
# Copyright (c) 2012, SoundCloud Ltd., Tobias Bielohlawek require 'fileutils' # Simple locker to make sure no second process is running in paralell module MassiveSitemap LOCK_FILE = 'generator.lock' def lock!(&block) if block raise Errno::EACCES if ::File.exists?(LOCK_FILE) ::File.open(LOCK_FILE, 'w', ::File::EXCL) begin block.call ensure FileUtils.rm(LOCK_FILE) #unlock! end end end module_function :lock! end
Version data entries
5 entries across 5 versions & 1 rubygems