Skip to content

Commit

Permalink
add optional setting to disable some tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed Feb 21, 2025
1 parent 1c716dc commit 5ebb78d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,5 @@ coverage.xml
setup_dev.yml
11env/
query_schema.json
gunicorn_config.py
gunicorn_config.py
set_local_config.py
4 changes: 4 additions & 0 deletions api/tacticalrmm/core/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,10 @@ def cache_db_fields_task() -> None:

@app.task(bind=True)
def sync_mesh_perms_task(self):

if getattr(settings, "TRMM_DISABLE_MESH_SYNC_TASK", False):
return

with redis_lock(SYNC_MESH_PERMS_TASK_LOCK, self.app.oid) as acquired:
if not acquired:
return f"{self.app.oid} still running"
Expand Down
7 changes: 7 additions & 0 deletions api/tacticalrmm/winupdate/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from contextlib import suppress
from zoneinfo import ZoneInfo

from django.conf import settings
from django.utils import timezone as djangotime
from packaging import version as pyver

Expand All @@ -17,6 +18,9 @@
def auto_approve_updates_task() -> None:
# scheduled task that checks and approves updates daily

if getattr(settings, "TRMM_DISABLE_APPROVE_UPDATES_TASK", False):
return

agents = Agent.objects.only(
"pk", "agent_id", "version", "last_seen", "overdue_time", "offline_time"
)
Expand All @@ -43,6 +47,9 @@ def auto_approve_updates_task() -> None:

@app.task
def check_agent_update_schedule_task() -> None:

if getattr(settings, "TRMM_DISABLE_WINUPDATES_INSTALL_TASK", False):
return
# scheduled task that installs updates on agents if enabled
for agent in Agent.online_agents(min_version="1.3.0"):
agent.delete_superseded_updates()
Expand Down

0 comments on commit 5ebb78d

Please sign in to comment.