projects
/
pharext
/
pharext.org
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
github: fix notices
[pharext/pharext.org]
/
app
/
Github
/
API
/
Call.php
diff --git
a/app/Github/API/Call.php
b/app/Github/API/Call.php
index 4e0513db60b73a66212f9ac5a7e24c1df871fa5b..21fd45f016fb808802531baa5113baa37dc3ef40 100644
(file)
--- a/
app/Github/API/Call.php
+++ b/
app/Github/API/Call.php
@@
-82,7
+82,10
@@
abstract class Call
$this->request(),
function($response) {
try {
$this->request(),
function($response) {
try {
- $this->deferred->resolve($this->response($response));
+ $result = $this->response($response);
+ if (!($result instanceof Promise\PromiseInterface)) {
+ $this->deferred->resolve($result);
+ }
} catch (\Exception $e) {
$this->deferred->reject($e);
}
} catch (\Exception $e) {
$this->deferred->reject($e);
}
@@
-136,9
+139,17
@@
abstract class Call
return false;
}
if (!$cache->get($key, $cached)) {
return false;
}
if (!$cache->get($key, $cached)) {
+ if ($cached) {
+ $this->api->getLogger()->debug(
+ sprintf("Cache-Stale: $this [TTL=%d]", $cached->getTTL()),
+ $this->args);
+ } else {
+ $this->api->getLogger()->debug("Cache-Miss: $this", $this->args);
+ }
return false;
}
if (null !== $this->api->getMaxAge() && $cached->getAge() > $this->api->getMaxAge()) {
return false;
}
if (null !== $this->api->getMaxAge() && $cached->getAge() > $this->api->getMaxAge()) {
+ $this->api->getLogger()->debug("Cache-Refresh: $this", $this->args);
return false;
}
$this->api->getLogger()->debug("Cache-Hit: $this", $this->args);
return false;
}
$this->api->getLogger()->debug("Cache-Hit: $this", $this->args);
@@
-156,6
+167,7
@@
abstract class Call
$key = $this->getCacheKey();
$cache->set($key, new Item($fresh, $ttl));
$key = $this->getCacheKey();
$cache->set($key, new Item($fresh, $ttl));
+ $this->api->getLogger()->debug("Cache-Push: $this", $this->args);
}
}
}
}
@@
-163,6
+175,7
@@
abstract class Call
if (($cache = $this->api->getCacheStorage())) {
$key = $this->getCacheKey();
$cache->del($key);
if (($cache = $this->api->getCacheStorage())) {
$key = $this->getCacheKey();
$cache->del($key);
+ $this->api->getLogger()->debug("Cache-Drop: $this", $this->args);
}
}
}
}
}
}