Conversation
Contributor
|
See more at https://github.com/apify/apify-client-js/actions/runs/37321221161#summary-111800489211 |
This branch has not been deployed
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 at all. That made the integration testcall({ log: "default" }) streams the run log to the console while the run executesfail now and then in CI (4 times so far, each green on retry).The API answers
GET /logs/:id?stream=1with an empty 200 and closes it right away when the run hasn't written its first line yet (apify-coresrc/api/src/routes/logs/log.ts).StreamedLogopened the stream once, right afterstart(), so it took that empty response as the whole log. Hitting the API directly reproduced it in 1 of 20 freshly startedapify/hello-worldruns.StreamedLognow reopens a stream that ended without any bytes, after a 500 ms pause thatstop()cuts short. Ifstop()comes before anything has arrived, including while a reopened stream is still connecting, it reads the log once with a plainget(). A run that finishes quickly still gets its whole log redirected, and a stream opened duringstop()can't cut it off after the first chunk.Tests cover five cases, each one also in apify/apify-client-python#1084:
getStreamedLog())stop()reads the whole log (call())stop()lands while the reopened stream is connectingstop()still resolvesThe first three fail without the fix. The live integration test passed 30 of 30 runs afterwards.
The Python client had the same bug: apify/apify-client-python#1084.
✍️ Drafted by Claude Code