Skip to content

Commit

Permalink
added pseudo for watch
Browse files Browse the repository at this point in the history
  • Loading branch information
iangeckeler committed Aug 9, 2019
1 parent c6578e7 commit fe51755
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/custom-services/healthcheck-handlers/check.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = function(call) {
);
}
healthArray.push({
service: requestedServices,
service: requestedServices[i],
status: curStatus
});
}
Expand Down
24 changes: 24 additions & 0 deletions lib/custom-services/healthcheck-handlers/watch.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,28 @@
// check status will take in the server object, so it has a reference and can continually check the status, and return an updated Health object to send back to client

// if no services provided, returns whole status map in the format of the proto file
// this is


// NOTE the check status function is basically the handler for Check.js as you already noted
function checkStatus(Server, call, services) {}

module.exports = function(call) {
// call.body will have this structure:
// {
// interval: number
// services: []
// }
console.log(call.body);
console.log("this inside of check", this);

// destructure services and interval off of the call

// if interval is 0, set it to be 60seconds for a default

// set a const "server" to be the value of this (this is currently the server, so you have access to the get status properties) to store in the closure

// setInterval at "interval seconds"
// run checkStatus to checkStatus calling on server and the services destructured off of call
// add logic to .throw
};
2 changes: 1 addition & 1 deletion lib/custom-services/healthcheck.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ service HealthCheck {
message CheckHealthCheckRequest { repeated string services = 1; }

message WatchHealthCheckRequest {
string interval = 1;
number interval = 1;
repeated string services = 2;
}

Expand Down

0 comments on commit fe51755

Please sign in to comment.