Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
invalid_published_request.forEach(function (publishData) {
console.log(" CANCELING TIMEOUT PUBLISH REQUEST ".cyan);
const response = new subscription_service.PublishResponse({
responseHeader: {serviceResult: StatusCodes.BadTimeout}
});
self.send_response_for_request(publishData, response);
});
};
assert(param.hasOwnProperty("subscriptionId"));
assert(param.hasOwnProperty("sequenceNumber"));
assert(param.hasOwnProperty("notificationData"));
assert(param.hasOwnProperty("moreNotifications"));
const subscription = self.getSubscriptionById(param.subscriptionId);
const subscriptionId = param.subscriptionId;
const sequenceNumber = param.sequenceNumber;
const notificationData = param.notificationData;
const moreNotifications = param.moreNotifications;
const availableSequenceNumbers = subscription ? subscription.getAvailableSequenceNumbers() : [];
const response = new subscription_service.PublishResponse({
subscriptionId: subscriptionId,
availableSequenceNumbers: availableSequenceNumbers,
moreNotifications: moreNotifications,
notificationMessage: {
sequenceNumber: sequenceNumber,
publishTime: new Date(),
notificationData: notificationData
}
});
if (self.pendingPublishRequestCount === 0) {
console.log(" ---------------------------------------------------- PUSHING PUBLISH RESPONSE FOR LATE ANWSER !".bgRed.white.bold);
self._publish_response_queue.push(response);
} else {
const publishData = self._publish_request_queue.shift();
self.send_response_for_request(publishData, response);
ServerSidePublishEngine.prototype.send_error_for_request = function (publishData, statusCode) {
const self = this;
_assertValidPublishData(publishData);
self.send_response_for_request(publishData, new subscription_service.PublishResponse({
responseHeader: {serviceResult: statusCode}
}));
};