mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-23 04:25:21 +00:00
sculpt: limit rate of depot queries
The triggering of a new depot query can happen more than once per activation of the sculpt manager if multiple conditions call for updated information about the depot. When this happens, the depot-query component produces intermediate results, which are not consumed by the sculpt manager. By deferring depot queries for a few milliseconds, we avoid such intermediate queries, relieving the workload of the depot-query component at system boot time. Issue #3436
This commit is contained in:
parent
58a0f5c30b
commit
c7e79030dd
@ -18,6 +18,7 @@
|
||||
#include <os/reporter.h>
|
||||
#include <nitpicker_session/connection.h>
|
||||
#include <vm_session/vm_session.h>
|
||||
#include <timer_session/connection.h>
|
||||
|
||||
/* included from depot_deploy tool */
|
||||
#include <children.h>
|
||||
@ -213,14 +214,15 @@ struct Sculpt::Main : Input_event_handler,
|
||||
return _query_version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Depot_query interface
|
||||
*/
|
||||
void trigger_depot_query() override
|
||||
{
|
||||
_query_version.value++;
|
||||
Timer::Connection _timer { _env };
|
||||
|
||||
Timer::One_shot_timeout<Main> _deferred_depot_query_handler {
|
||||
_timer, *this, &Main::_handle_deferred_depot_query };
|
||||
|
||||
void _handle_deferred_depot_query(Duration)
|
||||
{
|
||||
if (_deploy._arch.valid()) {
|
||||
_query_version.value++;
|
||||
_depot_query_reporter.generate([&] (Xml_generator &xml) {
|
||||
xml.attribute("arch", _deploy._arch);
|
||||
xml.attribute("version", _query_version.value);
|
||||
@ -233,6 +235,21 @@ struct Sculpt::Main : Input_event_handler,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Depot_query interface
|
||||
*/
|
||||
void trigger_depot_query() override
|
||||
{
|
||||
/*
|
||||
* Defer the submission of the query for a few milliseconds because
|
||||
* 'trigger_depot_query' may be consecutively called several times
|
||||
* while evaluating different conditions. Without deferring, the depot
|
||||
* query component would produce intermediate results that take time
|
||||
* but are ultimately discarded.
|
||||
*/
|
||||
_deferred_depot_query_handler.schedule(Microseconds{5000});
|
||||
}
|
||||
|
||||
|
||||
/*********************
|
||||
** Blueprint query **
|
||||
|
Loading…
x
Reference in New Issue
Block a user