mirror of
https://github.com/beestat/app.git
synced 2025-06-04 06:07:19 -04:00
Optimized metric fetching.
This commit is contained in:
parent
bb93805e20
commit
bdcb59a2c4
@ -491,17 +491,22 @@ class thermostat extends cora\crud {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$memory_limit = 16; // mb
|
||||||
|
$memory_per_thermostat = 0.0054; // mb
|
||||||
|
|
||||||
$limit_start = 0;
|
$limit_start = 0;
|
||||||
$limit_count = 250;
|
$limit_count = round($memory_limit / $memory_per_thermostat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Selecting lots of rows can eventually run PHP out of memory, so chunk
|
* Selecting lots of rows can eventually run PHP out of memory, so chunk
|
||||||
* this up into several queries to avoid that.
|
* this up into several queries to avoid that.
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
|
var_dump('before = ' . memory_get_usage());
|
||||||
$result = $this->database->query('
|
$result = $this->database->query('
|
||||||
select
|
select
|
||||||
*
|
thermostat_id,
|
||||||
|
profile
|
||||||
from
|
from
|
||||||
thermostat
|
thermostat
|
||||||
where ' .
|
where ' .
|
||||||
|
Loading…
x
Reference in New Issue
Block a user