Skip to content
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

On http changes for workflow progress #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

pengz1
Copy link
Owner

@pengz1 pengz1 commented Oct 13, 2016

Code for review.

var self = this;

if (_.has(message, 'nodeId')) {
return self.postNodeNotification(message);
} else if (_.has(message, 'taskId') && _.has(message, 'progress')) {
// This will be progress update notification if taskId is specified
return self.postProgressEvent(message);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to refactor this to following so other develops can choose to develop other task notifications other than progress notification.

       } else if (_.has(message, 'taskId')) {
            if (_.has(message, 'progress'))
            {
                // This will be progress update notification if taskId is specified
                return self.postProgressEvent(message);
            }
            if (_.has(message, 'SOMETHING_ELSE'))
            {
                // others can choose to post other kind of task notification without need to modify your code. 
            }

return eventsProtocol.publishBroadcastNotification(message)
.then(function () {
return message;
});
};

return new notificationApiService();
NotificationApiService.prototype.postProgressEvent = function(data) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to change function name to postProgressNotification to be better aligned with previous function. This is not a big deal anyway.

taskName: graphObject[0].tasks[data.taskId].friendlyName,
progress: data.progress
}
};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggest to return something in this .then block. One option would be combine following then block with this one.

return new notificationApiService();
NotificationApiService.prototype.postProgressEvent = function(data) {
var progressData;
return waterline.taskdependencies.find({taskId: data.taskId})
Copy link

@cgx027 cgx027 Oct 14, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy @yyscamper 's comments at on-taskgraph:

use 'findOne instead offind, so that you can use graphObject rather
than graphObject[0]` in following code.

Copy link

@cgx027 cgx027 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great overall. 👍 after review comments.

pengz1 pushed a commit that referenced this pull request Jul 6, 2017
add callback handler for wsman microservices
pengz1 pushed a commit that referenced this pull request Aug 18, 2017
Add SEL/LC logging via inventory microservice.  Expose through northb…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants