Browse Source

fix calendar cache time

yggdrasil-0.4.7
ghost 1 year ago
parent
commit
0ab7267dd3
  1. 8
      src/public/index.php
  2. 4
      src/public/peer.php

8
src/public/index.php

@ -46,9 +46,9 @@ foreach ($calendar->getNodes() as $day => $node) { @@ -46,9 +46,9 @@ foreach ($calendar->getNodes() as $day => $node) {
case 'peers':
$timeThis = strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day));
$timeFrom = strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day));
$timeTo = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day)));
$timeThis = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day)));
$dbPeerTotalByTimeUpdated = $memory->getByMethodCallback(
$db, 'findPeerTotalByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time()
@ -65,9 +65,9 @@ foreach ($calendar->getNodes() as $day => $node) { @@ -65,9 +65,9 @@ foreach ($calendar->getNodes() as $day => $node) {
// Add hourly stats
for ($hour = 0; $hour < 24; $hour++) {
$timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour));
$timeFrom = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour));
$timeTo = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour + 1));
$timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour + 1));
$dbPeerTotalByTimeUpdated = $memory->getByMethodCallback(
$db, 'findPeerTotalByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time()
@ -84,9 +84,9 @@ foreach ($calendar->getNodes() as $day => $node) { @@ -84,9 +84,9 @@ foreach ($calendar->getNodes() as $day => $node) {
break;
case 'traffic':
$timeThis = strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day));
$timeFrom = strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day));
$timeTo = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day)));
$timeThis = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day)));
$dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback(
$db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time()
@ -103,9 +103,9 @@ foreach ($calendar->getNodes() as $day => $node) { @@ -103,9 +103,9 @@ foreach ($calendar->getNodes() as $day => $node) {
// Add hourly stats
for ($hour = 0; $hour < 24; $hour++) {
$timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour));
$timeFrom = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour));
$timeTo = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour + 1));
$timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour + 1));
$dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback(
$db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time()

4
src/public/peer.php

@ -48,9 +48,9 @@ foreach ($calendar->getNodes() as $day => $node) { @@ -48,9 +48,9 @@ foreach ($calendar->getNodes() as $day => $node) {
case 'traffic':
$timeThis = strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day));
$timeFrom = strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day));
$timeTo = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y', $requestTime), date('n', $requestTime), $day)));
$timeThis = strtotime('+1 day', strtotime(sprintf('%s-%s-%s 00:00', date('Y'), date('n'), $day)));
$dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback(
$db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time()
@ -67,9 +67,9 @@ foreach ($calendar->getNodes() as $day => $node) { @@ -67,9 +67,9 @@ foreach ($calendar->getNodes() as $day => $node) {
// Add hourly stats
for ($hour = 0; $hour < 24; $hour++) {
$timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour));
$timeFrom = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour));
$timeTo = strtotime(sprintf('%s-%s-%s %s:00', date('Y', $requestTime), date('n', $requestTime), $day, $hour + 1));
$timeThis = strtotime(sprintf('%s-%s-%s %s:00', date('Y'), date('n'), $day, $hour + 1));
$dbPeerSessionSentSumByTimeUpdated = $memory->getByMethodCallback(
$db, 'findPeerSessionSentSumByTimeUpdated', [$timeFrom, $timeTo, $requestPeerId], ($timeTo <= $timeThis ? 2592000 : MEMCACHED_TIMEOUT) + time()

Loading…
Cancel
Save