mirror of
https://git.proxmox.com/git/pve-access-control
synced 2025-10-05 00:28:10 +00:00
Add is_worker to RPCEnvironment
after forking the actual worker process, the child/worker sets a flag that can be checked later on by methods called in the worker. used in the ZFS storage plugins in pve-storage to decide on a short or long default timeout for ZFS operations.
This commit is contained in:
parent
8643c99de5
commit
7b6dfe82df
@ -28,6 +28,7 @@ my $pve_env;
|
|||||||
# that (also see perlipc)
|
# that (also see perlipc)
|
||||||
|
|
||||||
my $WORKER_PIDS;
|
my $WORKER_PIDS;
|
||||||
|
my $WORKER_FLAG = 0;
|
||||||
|
|
||||||
my $log_task_result = sub {
|
my $log_task_result = sub {
|
||||||
my ($upid, $user, $status) = @_;
|
my ($upid, $user, $status) = @_;
|
||||||
@ -614,6 +615,10 @@ sub get_user {
|
|||||||
return $self->{user};
|
return $self->{user};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub is_worker {
|
||||||
|
return $WORKER_FLAG;
|
||||||
|
}
|
||||||
|
|
||||||
# read/update list of active workers
|
# read/update list of active workers
|
||||||
# we move all finished tasks to the archive index,
|
# we move all finished tasks to the archive index,
|
||||||
# but keep aktive and most recent task in the active file.
|
# but keep aktive and most recent task in the active file.
|
||||||
@ -808,6 +813,7 @@ sub fork_worker {
|
|||||||
if (!$cpid) { # child
|
if (!$cpid) { # child
|
||||||
|
|
||||||
$0 = "task $upid";
|
$0 = "task $upid";
|
||||||
|
$WORKER_FLAG = 1;
|
||||||
|
|
||||||
$SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub { die "received interrupt\n"; };
|
$SIG{INT} = $SIG{QUIT} = $SIG{TERM} = sub { die "received interrupt\n"; };
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user