X-Git-Url: https://wannabe.guru.org/gitweb/?a=blobdiff_plain;f=lockfile.py;h=290710759dbc702fff757ae2561fe5c0af3051a6;hb=413d28443c7308414e8d283b9c5b9037463274f3;hp=38134b20d02f00f8d419b5ddfef669c5002a4abf;hpb=31c81f6539969a5eba864d3305f9fb7bf716a367;p=python_utils.git diff --git a/lockfile.py b/lockfile.py index 38134b2..2907107 100644 --- a/lockfile.py +++ b/lockfile.py @@ -18,7 +18,7 @@ cfg = config.add_commandline_args(f'Lockfile ({__file__})', 'Args related to loc cfg.add_argument( '--lockfile_held_duration_warning_threshold_sec', type=float, - default=10.0, + default=60.0, metavar='SECONDS', help='If a lock is held for longer than this threshold we log a warning', ) @@ -129,10 +129,7 @@ class LockFile(object): if self.locktime: ts = datetime.datetime.now().timestamp() duration = ts - self.locktime - if ( - duration - >= config.config['lockfile_held_duration_warning_threshold_sec'] - ): + if duration >= config.config['lockfile_held_duration_warning_threshold_sec']: str_duration = datetime_utils.describe_duration_briefly(duration) msg = f'Held {self.lockfile} for {str_duration}' logger.warning(msg)