Skip to content

Commit

Permalink
Add hourly constraint between reports
Browse files Browse the repository at this point in the history
implemented new constraint to prevent two reports from being voted if they have less than 6 hours difference. This is mostly to prevent issues with Steem BC timing out and sending incorrect response that post was not created, but also to circumvent potential abuse.
  • Loading branch information
mcfarhat committed Nov 9, 2018
1 parent 3d06903 commit 07b6b78
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions curation-bot.js
Expand Up @@ -594,8 +594,25 @@ function processVotes(query, subsequent) {
console.log(this_date);
continue;
}
}else if (last_index != -1){
console.log('last_index:'+last_index);
console.log(post.author+post.url);
//adding condition to reject a post if a prior one exists that is less than 6 hours away
let last_voted = votePosts[last_index];
//console.log(last_voted.author+last_voted.url);
var last_date = moment(last_voted.created).toDate();
var this_date = moment(post.created).toDate();
//check the hours difference
var hours_diff = Math.abs(this_date - last_date) / 36e5;
if (hours_diff<parseFloat(config.min_posting_hours_diff)){
//skip new post
console.log('hours difference:'+hours_diff+'...skipping');
continue;
}

}


console.log('Voting on: ' + post.url);
votePosts.push(post);

Expand Down

0 comments on commit 07b6b78

Please sign in to comment.