pomander icon indicating copy to clipboard operation
pomander copied to clipboard

deploy.lock

Open tamagokun opened this issue 11 years ago • 2 comments

While a deploy is running, create a deploy.lock file so that subsequent deploys cannot be happening at the same time.

Things to look out for:

If a deploy fails, will it always be able to remove the deploy.lock file? If it cannot, people will be stuck without being able to deploy.

tamagokun avatar Jan 30 '14 11:01 tamagokun

There would need to be a "force" option to override a locked deploy.

tamagokun avatar Feb 28 '14 12:02 tamagokun

You can look at flock. Example code

$flock = new FLock(__CLASS__);
if ($flock->isLocked()) {
    $output->writeln("<error> Command ". $this->getName(). " already running in this system. Kill it or try again later </error>", OutputInterface::VERBOSITY_QUIET);                                                                    
    return -1;
}

which uses class Flock from https://github.com/intaro/pinboard/issues/61#issuecomment-35647379. This realization must unlock file when process failed.

muxx avatar Feb 28 '14 23:02 muxx