Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

WIP updates lastSeen in recordResponseTime function in contact model #147

Closed
wants to merge 3 commits into from

Conversation

navillasa
Copy link
Contributor

@navillasa navillasa commented Feb 26, 2018

In process of closing storj-archived/bridge#557 .
We want to use the lastSeen metric to decide when to send ALLOC messages to contacts.

This needs to be merged before storj-archived/bridge#577 , in order to make sure that every contact has updated lastSeen time.

@@ -190,6 +190,7 @@ ContactSchema.methods.recordResponseTime = function(responseTime) {
const newResponseTime = responseTime * k + lastResponseTime * (1 - k);

this.responseTime = newResponseTime;
this.lastSeen = Date.now();
Copy link
Contributor

Choose a reason for hiding this comment

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

recordResponseTime is also used when there is a timeout, the responseTime is the amount of time it took to timeout in that case. So it doesn't necessary mean that the contact was seen here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants