From bbc4b165761b359115fd1a249ea22e64d55db384 Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Tue, 24 May 2022 05:28:35 +0300 Subject: Fix some linting issues --- sheepdog/worker.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sheepdog') diff --git a/sheepdog/worker.py b/sheepdog/worker.py index 0209699..6557ab3 100644 --- a/sheepdog/worker.py +++ b/sheepdog/worker.py @@ -2,8 +2,9 @@ import os import sys import time -import redis import argparse + +import redis import redis.connection # Enable importing from one dir up: put as first to override any other globally @@ -28,9 +29,7 @@ def make_incremental_backoff(init_val: float=0.1, maximum: int=420): return current if command == "increment": - current = current + abs(value) - if current > maximum: - current = maximum + current = min(current + abs(value), maximum) return current return current @@ -54,8 +53,10 @@ def run_jobs(conn, queue_name: str = "GN3::job-queue"): else: update_status(conn, cmd_id, "error") return cmd_id + return None def parse_cli_arguments(): + """Parse the command-line arguments.""" parser = argparse.ArgumentParser( description="Run asynchronous (service) commands.") parser.add_argument( -- cgit v1.2.3