Skip to content

Commit

Permalink
Clean up redundant is_active checks
Browse files Browse the repository at this point in the history
The is_active check is done during start anyways.

Change-Id: Id5f5e7774e60b8b083156e0cfd7e518f2e075bf3
  • Loading branch information
LarsMichelsen committed Nov 22, 2024
1 parent 32cc2eb commit 7bc8317
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 26 deletions.
5 changes: 0 additions & 5 deletions cmk/gui/userdb/_user_profile_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from cmk.gui.background_job import BackgroundJob, BackgroundProcessInterface, InitialStatusArgs
from cmk.gui.i18n import _
from cmk.gui.log import logger as gui_logger

from ..logged_in import user
from .store import load_users
Expand All @@ -23,10 +22,6 @@ def execute_user_profile_cleanup_job() -> None:
Errors are logged to var/log/web.log."""
job = UserProfileCleanupBackgroundJob()
if job.is_active():
gui_logger.debug("Job is already running: Skipping this time")
return

job.start(
job.do_execute,
InitialStatusArgs(
Expand Down
3 changes: 0 additions & 3 deletions cmk/gui/userdb/user_sync_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ def execute_userdb_job() -> None:
return

job = UserSyncBackgroundJob()
if job.is_active():
gui_logger.debug("Another synchronization job is already running: Skipping this sync")
return

if not job.shall_start():
gui_logger.debug("Job shall not start")
Expand Down
3 changes: 0 additions & 3 deletions cmk/gui/watolib/_sync_remote_sites.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,6 @@ def execute_sync_remote_sites() -> None:
return

job = SyncRemoteSitesBackgroundJob()
if job.is_active():
logger.debug("Another 'sync remote sites' job is already running: Skipping this time.")
return

if not job.shall_start():
logger.debug("Job shall not start")
Expand Down
4 changes: 0 additions & 4 deletions cmk/gui/watolib/activate_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1966,10 +1966,6 @@ def execute_activation_cleanup_background_job(maximum_age: int | None = None) ->
else:
job = ActivationCleanupBackgroundJob()

if job.is_active():
logger.debug("Another activation cleanup job is already running: Skipping this time")
return

if not job.shall_start():
logger.debug("Job shall not start")
return
Expand Down
4 changes: 0 additions & 4 deletions cmk/gui/watolib/autodiscovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ def execute_autodiscovery() -> None:
return

job = AutodiscoveryBackgroundJob()
if job.is_active():
logger.debug("Another 'autodiscovery' job is already running: Skipping this time.")
return

job.start(
job.do_execute,
InitialStatusArgs(
Expand Down
9 changes: 2 additions & 7 deletions cmk/gui/watolib/automatic_host_removal.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,14 @@ def execute_host_removal_background_job() -> None:
if is_wato_slave_site():
return

job = HostRemovalBackgroundJob()
if job.is_active():
_LOGGER.debug("Another host removal job is already running, skipping this time.")
return

if not _load_automatic_host_removal_ruleset():
_LOGGER.debug("Automatic host removal not configured")
return

job.start(
HostRemovalBackgroundJob().start(
_do_remove_hosts,
InitialStatusArgs(
title=job.gui_title(),
title=HostRemovalBackgroundJob.gui_title(),
lock_wato=False,
stoppable=False,
user=str(user.id) if user.id else None,
Expand Down

0 comments on commit 7bc8317

Please sign in to comment.