Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. async removeExpiredPendingRequest(pendingRequests, pendingRequestTTLLimit){
  2. if(pendingRequestTTLLimit === NO_PENDING_REQUEST_TTL)
  3. return pendingRequests
  4.  
  5. const now = new Date().getTime();
  6. //TODO:: change seconds to hours
  7. return _.remove(pendingRequests, (pendingRequest) => {
  8. const addedTimePlusTtlInterval = new Date(pendingRequest.added_at + pendingRequestTTLLimit * 1000);
  9. return now < addedTimePlusTtlInterval;
  10. });
  11. }
  12.  
  13. this.removeExpiredPendingRequest(pendingRequests, this.friendsConfig.pending_request_ttl_hours);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement