update the total_disk_space function to do and sql sum on the events that already have a space assigned and only update ones that don't. This reduces ram requirements.
This commit is contained in:
parent
a836dd5ab3
commit
f99e404730
|
@ -113,7 +113,9 @@ class Storage {
|
||||||
if ( ! array_key_exists( 'disk_used_space', $this ) ) {
|
if ( ! array_key_exists( 'disk_used_space', $this ) ) {
|
||||||
$used = 0;
|
$used = 0;
|
||||||
if ( $this->{'Type'} == 's3fs' ) {
|
if ( $this->{'Type'} == 's3fs' ) {
|
||||||
foreach ( Event::find_all( array( 'StorageId'=>$this->Id() ) ) as $Event ) {
|
$used = dbFetchOne('SELECT SUM(DiskSpace) FROM EVents WHERE StorageId=? AND DiskSpace IS NOT NULL', 'DiskSpace', array($this-Id()) );
|
||||||
|
|
||||||
|
foreach ( Event::find_all( array( 'StorageId'=>$this->Id(), 'DiskSpace'=>null ) ) as $Event ) {
|
||||||
$Event->Storage( $this ); // Prevent further db hit
|
$Event->Storage( $this ); // Prevent further db hit
|
||||||
$used += $Event->DiskSpace();
|
$used += $Event->DiskSpace();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue