Permalink
Browse files

Fix MqObs fallback

  • Loading branch information...
1 parent 928bb4e commit 4bac0a71e961f15e80241355a1a71648e4fb0031 @cdujeu cdujeu committed May 23, 2016
@@ -37,6 +37,10 @@ class SerializableResponseStream implements StreamInterface
* @var SerializableResponseChunk[]
*/
protected $data = [];
+ /**
+ * @var string SerializedContent
+ */
+ protected $serializedContent;
private $streamStatus = 'open';
@@ -59,6 +63,9 @@ public function addChunk($chunk){
*/
public function getContents()
{
+ if(isSet($this->serializedContent)){
+ return $this->serializedContent;
+ }
return $this->serializeData($this->data, $this->serializer);
}
@@ -168,7 +175,8 @@ public function detach()
public function getSize()
{
if(!empty($this->data)){
- return 1;
+ $this->serializedContent = $this->getContents();
+ return strlen($this->serializedContent);
}else{
return 0;
}
@@ -221,9 +221,13 @@ Class.create("AjxpMqObserver", {
this._pollingFreqObs = function(freq){
var value = freq.value ? freq.value : this.defaultPollerFreq;
if(value == this.pollingFrequency) return;
+ var lastPing = (value > this.pollingFrequency ? this.pollingFrequency: 0);
this.pollingFrequency = value;
this.pe.stop();
this.pe = new PeriodicalExecuter(this.consumeChannel.bind(this), value);
+ if(lastPing){
+ window.setTimeout(this.consumeChannel.bind(this), lastPing * 1000);
+ }
}.bind(this);
pydio.observe("poller.frequency", this._pollingFreqObs);
@@ -112,6 +112,11 @@ public function route(ServerRequestInterface &$request, ResponseInterface &$resp
}
+ /**
+ * @param AJXP_Node $node
+ * @param bool $isContextNode
+ * @param string $details
+ */
public function attachTasksToNode(AJXP_Node &$node, $isContextNode = false, $details = "all"){
if($details == "all"){
$t = TaskService::getInstance()->getActiveTasksForNode($node);
@@ -128,6 +133,10 @@ public function attachTasksToNode(AJXP_Node &$node, $isContextNode = false, $det
}
}
+ /**
+ * @param ServerRequestInterface $requestInterface
+ * @param ResponseInterface $responseInterface
+ */
public function enrichConsumeChannel(ServerRequestInterface &$requestInterface, ResponseInterface &$responseInterface){
$respType = &$responseInterface->getBody();

0 comments on commit 4bac0a7

Please sign in to comment.