Skip to content

Commit

Permalink
memcache: revert commit for the backend job
Browse files Browse the repository at this point in the history
  • Loading branch information
tpruvot committed Mar 6, 2018
1 parent 6a7bc6d commit 569661a
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions web/yaamp/modules/thread/CronjobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private function monitorApache()

$uptime = exec('uptime');

$apache_locked = $this->memcache->get('apache_locked');
$apache_locked = memcache_get($this->memcache->memcache, 'apache_locked');
if($apache_locked) return;

$b = preg_match('/load average: (.*)$/', $uptime, $m);
Expand Down Expand Up @@ -52,7 +52,7 @@ public function actionRunBlocks()

$this->monitorApache();

$last_complete = $this->memcache->get("cronjob_block_time_start");
$last_complete = memcache_get($this->memcache->memcache, "cronjob_block_time_start");
if($last_complete+(5*60) < time())
dborun("update jobs set active=false");

Expand All @@ -62,7 +62,7 @@ public function actionRunBlocks()
BackendProcessList();
BackendBlocksUpdate();

$this->memcache->set("cronjob_block_time_start", time());
memcache_set($this->memcache->memcache, "cronjob_block_time_start", time());
// debuglog(__METHOD__);
}

Expand All @@ -82,21 +82,21 @@ public function actionRunLoop2()

MonitorBTC();

$last = $this->memcache->get('last_renting_payout2');
$last = memcache_get($this->memcache->memcache, 'last_renting_payout2');
if($last + 5*60 < time())
{
$this->memcache->set('last_renting_payout2', time());
memcache_set($this->memcache->memcache, 'last_renting_payout2', time());
BackendRentingPayout();
}

$last = $this->memcache->get('last_stats2');
$last = memcache_get($this->memcache->memcache, 'last_stats2');
if($last + 5*60 < time())
{
$this->memcache->set('last_stats2', time());
memcache_set($this->memcache->memcache, 'last_stats2', time());
BackendStatsUpdate2();
}

$this->memcache->set("cronjob_loop2_time_start", time());
memcache_set($this->memcache->memcache, "cronjob_loop2_time_start", time());
// debuglog(__METHOD__);
}

Expand All @@ -107,11 +107,11 @@ public function actionRun()

// BackendRunCoinActions();

$state = $this->memcache->get('cronjob_main_state');
$state = memcache_get($this->memcache->memcache, 'cronjob_main_state');
if(!$state) $state = 0;

$this->memcache->set('cronjob_main_state', $state+1);
$this->memcache->set("cronjob_main_state_$state", 1);
memcache_set($this->memcache->memcache, 'cronjob_main_state', $state+1);
memcache_set($this->memcache->memcache, "cronjob_main_state_$state", 1);

switch($state)
{
Expand Down Expand Up @@ -177,20 +177,20 @@ public function actionRun()
break;

default:
$this->memcache->set('cronjob_main_state', 0);
memcache_set($this->memcache->memcache, 'cronjob_main_state', 0);
BackendQuickClean();

$t = $this->memcache->get("cronjob_main_start_time");
$t = memcache_get($this->memcache->memcache, "cronjob_main_start_time");
$n = time();

$this->memcache->set("cronjob_main_time", $n-$t);
$this->memcache->set("cronjob_main_start_time", $n);
memcache_set($this->memcache->memcache, "cronjob_main_time", $n-$t);
memcache_set($this->memcache->memcache, "cronjob_main_start_time", $n);
}

debuglog(__METHOD__." $state");
$this->memcache->set("cronjob_main_state_$state", 0);
memcache_set($this->memcache->memcache, "cronjob_main_state_$state", 0);

$this->memcache->set("cronjob_main_time_start", time());
memcache_set($this->memcache->memcache, "cronjob_main_time_start", time());
if(!YAAMP_PRODUCTION) return;

///////////////////////////////////////////////////////////////////
Expand All @@ -203,14 +203,14 @@ public function actionRun()
$mining->last_payout = time();
$mining->save();

$this->memcache->set('apache_locked', true);
memcache_set($this->memcache->memcache, 'apache_locked', true);
if(YAAMP_USE_NGINX)
system("service nginx stop");

sleep(10);
BackendDoBackup();

$this->memcache->set('apache_locked', false);
memcache_set($this->memcache->memcache, 'apache_locked', false);

BackendPayments();
BackendCleanDatabase();
Expand Down

0 comments on commit 569661a

Please sign in to comment.