Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
8ed00091
Commit
8ed00091
authored
Apr 13, 2020
by
Francesc Guasch
Browse files
refactor(backend): removed list domains before request
issue #1271
parent
610c50ec
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Ravada.pm
View file @
8ed00091
...
...
@@ -29,6 +29,7 @@ use Ravada::VM::Void;
our
%VALID_VM
;
our
%ERROR_VM
;
our
$TIMEOUT_STALE_PROCESS
;
eval
{
require
Ravada::VM::
KVM
and
do
{
...
...
@@ -2368,7 +2369,10 @@ sub process_priority_requests($self, $debug=0, $dont_fork=0) {
sub
_kill_stale_process
($self) {
my
@domains
=
$self
->
list_domains_data
();
if
(
!
$TIMEOUT_STALE_PROCESS
)
{
my
@domains
=
$self
->
list_domains_data
();
$TIMEOUT_STALE_PROCESS
=
scalar
(
@domains
)
*
5
+
60
;
}
my
$sth
=
$CONNECTOR
->
dbh
->
prepare
(
"
SELECT id,pid,command,start_time
"
.
"
FROM requests
"
...
...
@@ -2378,7 +2382,7 @@ sub _kill_stale_process($self) {
.
"
AND pid IS NOT NULL
"
.
"
AND start_time IS NOT NULL
"
);
$sth
->
execute
(
time
-
5
*scalar
(
@domains
)
-
60
);
$sth
->
execute
(
time
-
$TIMEOUT_STALE_PROCESS
);
while
(
my
(
$id
,
$pid
,
$command
,
$start_time
)
=
$sth
->
fetchrow
)
{
if
(
$pid
==
$$
)
{
warn
"
HOLY COW! I should kill pid
$pid
stale for
"
.
(
time
-
$start_time
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment