-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement ucsCallback job #540
Conversation
lib/jobs/ucs-base-job.js
Outdated
}); | ||
}; | ||
|
||
UcsBaseJob.prototype._subscribeHttpResponseUuidByPromisify = function(id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_subscribeHttpResponseUuid
is already a promise
(https://github.com/RackHD/on-tasks/blob/master/lib/jobs/base-job.js#L230), we don't need to promisify it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, since you want to Repromisify _subscribeHttpResponseUuid
, errors should be processed by calling callback
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, current code will eat all error scenes. I'm going to add error handler for asynchronous processing, to make sure errors can be found and handled.
lib/jobs/ucs-base-job.js
Outdated
}); | ||
}; | ||
|
||
UcsBaseJob.prototype._subscribeHttpResponseUuidByPromisify = function(id) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_subscribeHttpResponseUuid
is already a promise
(https://github.com/RackHD/on-tasks/blob/master/lib/jobs/base-job.js#L230), we don't need to promisify it again.
Change parameter from taskId to a uuid string named callbackId which is used to define a amqp channel. |
Background
UCSM http response is slower than RackHD in some cases and will lead to RackHD fails to get data from UCSM via HTTP. Thus in ucs-service we implemented asynchronous API to avoid this and data will be post back to RackHD via a callback API.
Details
Add new base job for ucs related job.
Unit test is included.
Depends on RackHD/on-http#802, RackHD/ucs-service#28
Paired with: @pengz1
@anhou @pengz1 @mcgG