nostrband / noauthd

Server for Noauth Nostr key manager.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix pause logic

nostrband opened this issue · comments

The only reason for pause is to avoid unnecessary push - so 1 sec pause is always present after req. Growing backoff is to avoid spamming the push api, so if we've waited enough (at night?) and have new req - can send immediately.

If req comes set 'pending=true' and set 'timer' to 1 sec. If 'timer' fires and next_push_time < now - send push and set 'backoff' to MIN_PAUSE or if not 0 - increase by 2x, set next_push_time to now+backoff. If timer fires and next_push_time > 0 then ignore - user should go and wake up the app manually. On rep clear 'timer' and set backoff to 0.

Fixed, merge feature/new-pause-logic to main