1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-11 04:36:48 +00:00

fix(operations): jobs see the Settings page values

Only the request middleware loaded the Settings page values, so in the
worker process app_settings stayed empty: a VM create job failed reading
the default volume format, and the snapshot free-space check fell back to
its defaults. The worker now loads them before each job.
This commit is contained in:
catborise 2026-10-15 09:49:21 +03:00
parent aabce6b037
commit 1fb709ea05
2 changed files with 17 additions and 0 deletions

View file

@ -21,6 +21,8 @@ from django.db import close_old_connections
from django.utils import timezone
from django.utils.translation import gettext_noop
from appsettings.settings import get_settings
from . import claims, jobs, utils
from .models import Claim, LeaseLost, Operation, acquire, fenced, renew
@ -272,6 +274,7 @@ def execute(worker, op_id):
op = Operation.objects.get(pk=op_id)
kind = jobs.get_kind(op.kind)
ctx = jobs.Context(op, worker)
get_settings() # the Settings page values; only requests load them otherwise (middleware)
try:
with claims.adopted(op):
kind.precheck(op, ctx)