Skip to content

Commit

Permalink
Optimize highest_server (#2350)
Browse files Browse the repository at this point in the history
  • Loading branch information
puzzledsab committed Nov 28, 2022
1 parent 5fef185 commit e9578d9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sabnzbd/downloader.py
Expand Up @@ -463,12 +463,13 @@ def is_paused(self):

def highest_server(self, me: Server):
"""Return True when this server has the highest priority of the active ones
0 is the highest priority
0 is the highest priority, servers are sorted by priority.
"""
for server in self.servers:
if server is not me and server.active and server.priority < me.priority:
if server.priority == me.priority:
return True
if server.active:
return False
return True

def maybe_block_server(self, server: Server):
# Was it resolving problem?
Expand Down

0 comments on commit e9578d9

Please sign in to comment.