Skip to content

Commit a860d8a

Browse files
authored
persistent logger (for bucket notifications) - don't log rename ENOENT if there were no failures (#8765)
Signed-off-by: Amit Prinz Setter <alphaprinz@gmail.com>
1 parent 2cf48bc commit a860d8a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/util/persistent_logger.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class PersistentLogger {
198198

199199
try {
200200
// Finally replace the current active so as to consume them in the next iteration
201-
await failure_log._replace_active();
201+
await failure_log._replace_active(!result);
202202
} catch (error) {
203203
dbg.error('failed to replace active failure log:', error, 'log_namespace:', this.namespace);
204204
}
@@ -208,14 +208,16 @@ class PersistentLogger {
208208
}
209209
}
210210

211-
async _replace_active() {
211+
async _replace_active(log_noent) {
212212
const inactive_file = `${this.namespace}.${Date.now()}.log`;
213213
const inactive_file_path = path.join(this.dir, inactive_file);
214214

215215
try {
216216
await nb_native().fs.rename(this.fs_context, this.active_path, inactive_file_path);
217217
} catch (error) {
218-
dbg.warn('failed to rename active file:', error);
218+
if (log_noent || error.code !== 'ENOENT') {
219+
dbg.warn('failed to rename active file:', error);
220+
}
219221
}
220222
}
221223

0 commit comments

Comments
 (0)