0

I have multiple Instances of the server. I have a s3 mounted location for files synchronization.and I have to update those files, one at a time...so I want to take a lock on that file, so that any other Instance cannot work on that file when one is already working.

nodejs npm's for LOCK work good for only within a server not around all Instances.

Is there a possible workaround for this?

Priyanka
  • 806
  • 1
  • 9
  • 21

1 Answers1

0

My Issue is Resolved not by any lock npm unfortunately,because I think these locks are on operating system basis and I am having multiple servers so I did it by a manual method.

I created a 0 byte file named Lock (random name) , before I do something, so If another process finds that file existing , it will assume there is a lock, and will return back with callback false.

This worked well around all Instances.

Priyanka
  • 806
  • 1
  • 9
  • 21