Skip to content

Commit

Permalink
amend fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wirwolf committed Apr 24, 2023
1 parent f1c1548 commit 366b99e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ HELM_DEBUG=false
HELM_DRY_RUN=false
KUBE_NAMESPACE=default
HELM_ASSISTANT_DEBUG=false
HELM_ASSISTANT_DEBUG_LEVEL=1
HELM_ASSISTANT_DEBUG_LEVEL=0
HELM_ASSISTANT_UPGRADE_PIPE_LOGS=false
HELM_ASSISTANT_UPGRADE_PIPE_LOGS_TAIL_LINES=10
HELM_ASSISTANT_UPGRADE_JOB_STRICT=false
Expand Down
14 changes: 7 additions & 7 deletions src/Components/ProcessLocker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ export default class ProcessLocker {
if (fs.existsSync(this.options.fsDirPath + '/' + resource + '.lock')) {
fs.unlink(this.options.fsDirPath + '/' + resource + '.lock', function(err) {
if (err) {
process.stderr.write('[realise-locker] ERROR: Can not remove lock file: ' + this.options.fsDirPath + '/' + resource + '.lock' + '\n');
process.stderr.write('[release-locker] ERROR: Can not remove lock file: ' + this.options.fsDirPath + '/' + resource + '.lock' + '\n');
resolve(true);
} else {
process.stdout.write('[realise-locker] INFO: Successfully unlock: ' + this.options.fsDirPath + '/' + resource + '.lock' + '\n');
process.stdout.write('[release-locker] INFO: Successfully unlock: ' + this.options.fsDirPath + '/' + resource + '.lock' + '\n');
resolve(true);
}
}.bind(this));
} else {
if (ConfigFactory.getCore().HELM_ASSISTANT_DEBUG_LEVEL >= 1) {
process.stderr.write('[realise-locker] DEBUG: lock file not found' + '\n');
process.stderr.write('[release-locker] DEBUG: lock file not found' + '\n');
}
resolve(true);
}
Expand All @@ -51,7 +51,7 @@ export default class ProcessLocker {

private async waitAvailability(key:string): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
process.stdout.write('[realise-locker] NOTICE: Waiting for lock on: ' + this.options.fsDirPath + '/' + key + '.lock' + '\n');
process.stdout.write('[release-locker] NOTICE: Waiting for lock on: ' + this.options.fsDirPath + '/' + key + '.lock' + '\n');
this.timer = setInterval(() => {
(async () => {
const content = this.getLockData(key);
Expand All @@ -63,7 +63,7 @@ export default class ProcessLocker {
}
const data = new Date(content.toString());
if (data < new Date()) {
process.stdout.write('[realise-locker] WARNING: Lock file exist but he is expired: ' + this.options.fsDirPath + '/' + key + '.lock' + '\n');
process.stdout.write('[release-locker] WARNING: Lock file exist but he is expired: ' + this.options.fsDirPath + '/' + key + '.lock' + '\n');
const result = await this.putLockData(key);
clearInterval(this.timer);
resolve(result);
Expand All @@ -87,10 +87,10 @@ export default class ProcessLocker {
return new Promise(function(resolve, reject) {
fs.writeFile(this.options.fsDirPath + '/' + key + '.lock', date.toString(), 'utf8', function(err) {
if (err) {
process.stderr.write('\n' + '[realise-locker] ERROR: Can not create lock file: ' + JSON.stringify(err) + '\n');
process.stderr.write('\n' + '[release-locker] ERROR: Can not create lock file: ' + JSON.stringify(err) + '\n');
reject(false);
} else {
process.stdout.write('\n' + '[realise-locker] INFO: Successfully acquired lock on: ' + this.options.fsDirPath + '/' + key + '.lock' + '\n');
process.stdout.write('\n' + '[release-locker] INFO: Successfully acquired lock on: ' + this.options.fsDirPath + '/' + key + '.lock' + '\n');
resolve(true);
}
}.bind(this));
Expand Down

0 comments on commit 366b99e

Please sign in to comment.