Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async removeExpiredPendingRequest(pendingRequests, pendingRequestTTLLimit){
- if(pendingRequestTTLLimit === NO_PENDING_REQUEST_TTL)
- return pendingRequests
- const now = new Date().getTime();
- //TODO:: change seconds to hours
- return _.remove(pendingRequests, (pendingRequest) => {
- const addedTimePlusTtlInterval = new Date(pendingRequest.added_at + pendingRequestTTLLimit * 1000);
- return now < addedTimePlusTtlInterval;
- });
- }
- this.removeExpiredPendingRequest(pendingRequests, this.friendsConfig.pending_request_ttl_hours);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement