Commit 79b790f9 authored by skummer's avatar skummer

ZP-128 related

- added: indicate if the process waited to process changes

git-svn-id: https://z-push.org/svn/z-push/trunk@1337 b7dd7b3b-3a3c-0410-9da9-bee62a6cc5b5
parent 268055f9
...@@ -67,6 +67,8 @@ class SyncCollections implements Iterator { ...@@ -67,6 +67,8 @@ class SyncCollections implements Iterator {
private $globalWindowSize; private $globalWindowSize;
private $lastSyncTime; private $lastSyncTime;
private $waitingTime = 0;
/** /**
* Constructor * Constructor
...@@ -446,6 +448,9 @@ class SyncCollections implements Iterator { ...@@ -446,6 +448,9 @@ class SyncCollections implements Iterator {
$started = time(); $started = time();
$endat = time() + $lifetime; $endat = time() + $lifetime;
while(($now = time()) < $endat) { while(($now = time()) < $endat) {
// how long are we waiting for changes
$this->waitingTime = $now-$started;
$nextInterval = $interval; $nextInterval = $interval;
// we should not block longer than the lifetime // we should not block longer than the lifetime
if ($endat - $now < $nextInterval) if ($endat - $now < $nextInterval)
...@@ -508,7 +513,7 @@ class SyncCollections implements Iterator { ...@@ -508,7 +513,7 @@ class SyncCollections implements Iterator {
else { else {
ZPush::GetTopCollector()->AnnounceInformation(sprintf("Polling %d/%ds on %s", ($now-$started), $lifetime, $checkClasses)); ZPush::GetTopCollector()->AnnounceInformation(sprintf("Polling %d/%ds on %s", ($now-$started), $lifetime, $checkClasses));
if ($this->CountChanges($onlyPingable)) { if ($this->CountChanges($onlyPingable)) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): FOUND CHANGES", print_r($this->changes,1))); ZLog::Write(LOGLEVEL_DEBUG, sprintf("SyncCollections->CheckForChanges(): Found changes polling"));
return true; return true;
} }
else { else {
...@@ -608,6 +613,17 @@ class SyncCollections implements Iterator { ...@@ -608,6 +613,17 @@ class SyncCollections implements Iterator {
return $this->changes; return $this->changes;
} }
/**
* Indicates if the process did wait in a sink, polling or before running a
* regular export to find changes
*
* @access public
* @return array
*/
public function WaitedForChanges() {
return ($this->waitingTime > 1);
}
/** /**
* Simple Iterator Interface implementation to traverse through collections * Simple Iterator Interface implementation to traverse through collections
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment