Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
e8d1afb2
Commit
e8d1afb2
authored
May 13, 2019
by
Francesc Guasch
Browse files
wip(frontend): nodes status cache timeout
parent
9e464709
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/Ravada/Front.pm
View file @
e8d1afb2
...
...
@@ -877,6 +877,7 @@ sub list_requests($self, $id_domain_req=undef, $seconds=60) {
next
if
$command
eq
'
enforce_limits
'
||
$command
eq
'
refresh_vms
'
||
$command
eq
'
refresh_storage
'
||
$command
eq
'
refresh_machine
'
||
$command
eq
'
ping_backend
'
||
$command
eq
'
cleanup
'
||
$command
eq
'
screenshot
'
...
...
lib/Ravada/VM.pm
View file @
e8d1afb2
...
...
@@ -39,6 +39,8 @@ our $CONFIG = \$Ravada::CONFIG;
our
$MIN_MEMORY_MB
=
128
*
1024
;
our
$SSH_TIMEOUT
=
20
*
1000
;
our
$CACHE_TIMEOUT
=
60
;
our
$FIELD_TIMEOUT
=
'
_data_timeout
';
our
%VM
;
# cache Virtual Manager Connection
our
%SSH
;
...
...
@@ -690,6 +692,7 @@ sub _data($self, $field, $value=undef) {
# _init_connector();
$self
->
_timed_data_cache
()
if
$self
->
{
_data
}
->
{
$field
}
&&
$field
ne
'
name
';
return
$self
->
{
_data
}
->
{
$field
}
if
exists
$self
->
{
_data
}
->
{
$field
};
return
if
!
$self
->
store
();
...
...
@@ -701,6 +704,15 @@ sub _data($self, $field, $value=undef) {
return
$self
->
{
_data
}
->
{
$field
};
}
sub
_timed_data_cache
($self) {
return
if
time
-
$self
->
{
$FIELD_TIMEOUT
}
<
$CACHE_TIMEOUT
;
my
$name
=
$self
->
{
_data
}
->
{
name
};
my
$id
=
$self
->
{
_data
}
->
{
id
};
delete
$self
->
{
_data
};
$self
->
{
_data
}
->
{
name
}
=
$name
if
$name
;
$self
->
{
_data
}
->
{
id
}
=
$id
if
$id
;
}
sub
_do_select_vm_db
{
my
$self
=
shift
;
my
%args
=
@_
;
...
...
@@ -734,6 +746,7 @@ sub _select_vm_db {
my
(
$row
)
=
(
$self
->
_do_select_vm_db
(
@
_
)
or
$self
->
_insert_vm_db
(
@
_
));
$self
->
{
_data
}
=
$row
;
$self
->
{
$FIELD_TIMEOUT
}
=
time
if
$row
->
{
id
};
return
$row
if
$row
->
{
id
};
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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