Repository navigation
fix: redirect the run log when the first log stream comes back empty - #1105
Merged
Merged
Conversation
Contributor
|
See more at https://github.com/apify/apify-client-js/actions/runs/37913067559#summary-113762596216 |
…pty-start # Conflicts: # src/resource_clients/log.ts
Pijukatel
approved these changes
Oct 9, 2026
vdusek
added a commit
to apify/apify-client-python
that referenced
this pull request
Oct 9, 2026
…1084) Python twin of apify/apify-client-js#1105. `call(logger=...)` and `get_streamed_log()` sometimes redirected no log lines. Before a run writes its first line, the API answers `GET /logs/:id?stream=1` with an empty 200 that closes at once, and `StreamedLog` / `StreamedLogAsync` took that as the whole log. Both now reopen an empty stream after a pause that starts at 0.5 s and doubles up to 5 s. If `stop()` comes before anything has arrived, they read the log once with `get_as_bytes()`. `start()` resets that state, so a restarted instance behaves the same. Tests cover the same cases as #1105 for both classes and both HTTP clients, plus the backoff and a restart. *✍️ Drafted by Claude Code*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
call({ log })andrun.getStreamedLog()sometimes redirected no log lines, which made thecall({ log: "default" })integration test flaky. Before a run writes its first line, the API answersGET /logs/:id?stream=1with an empty 200 that closes at once (about 1 in 20 freshapify/hello-worldruns), andStreamedLogtook that as the whole log.StreamedLognow reopens an empty stream after a pause that starts at 500 ms and doubles up to 5 s. Ifstop()comes before anything has arrived, it reads the log once withget(). This also covers a stream still connecting when thestop()grace period ends.Tests cover the same cases as apify/apify-client-python#1084, plus the backoff and the grace-period fallback.
✍️ Drafted by Claude Code