Skip to content

flush(): port the post-deadline re-check from JS #29

Description

@anassg-lago

JS PR getlago/lago-agent-sdk-js#45 ends flush() with a final return this.outstanding() === 0 instead of a bare false, so a delivery that lands during the last 10ms poll sleep is still reported truthfully. Python's flush() (queue.py, merged in #25) returns a bare False after the deadline loop and can report a false negative in that window.

Port the re-check so the two repos match:

# queue.py, end of flush(), replacing `return False`
with self._lock:
    return not self._buffer and self._in_flight == 0

Plus a mirror of the JS comment explaining why the last sleep can straddle the deadline. Benign divergence (false-negative direction only), but behavior must match across the ports.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions