Skip to content

BatchRequestManager sendFn - $digest error. #39

Description

@ismael-texidor

I keep getting a digest error when this function runs. I added a timeout to make sure the digest is completed prior to running the callback function. Would you consider adding this timeout to the batcher?

function sendFn() {
  var self = this,
    adapter = self.getAdapter(),
    httpBatchConfig = adapter.buildRequest(self.requests, self.config);

  self.sendCallback();
  self.$injector.get('$http')(httpBatchConfig).then(function (response) {
    var batchResponses = adapter.parseResponse(self.requests, response, self.config);

    //timeout I inserted. 
    self.$timeout(function() {
      angular.forEach(batchResponses, function (batchResponse) {
        batchResponse.request.callback(
          batchResponse.statusCode,
          batchResponse.data,
          convertHeadersToString(batchResponse.headers),
          batchResponse.statusText);
      });
    },0,true);
  }, function (err) {
    angular.forEach(self.requests, function (request) {
      request.callback(err.statusCode, err.data, err.headers, err.statusText);
    });
  });
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions