Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialize writes of JSON playlist #1932

Merged
merged 3 commits into from
Jul 22, 2021
Merged

Serialize writes of JSON playlist #1932

merged 3 commits into from
Jul 22, 2021

Conversation

darkdarkdragon
Copy link
Contributor

@darkdarkdragon darkdarkdragon commented Jun 26, 2021

What does this pull request do? Explain your changes. (required)
Fixes Error saving json playlist error.
We're making a lot of writes (to object store) to same json playlist file during stream.
Each write starts in own goroutine, so often new writes starts before previous completed.
In that case request to Google Cloud Storage often takes more than 10s, which is our timeout.
This PR fixes problem by serializing write requests.

Specific updates (required)

  • Create new OvewriteQueue class that serializes writes to the same file in OS.
  • Use OvewriteQueue for writing JSON playlists.

How did you test each of these updates (required)
Unit tests

Does this pull request close any open issues?
Fixes #1924

Checklist:

@darkdarkdragon darkdarkdragon force-pushed the it/playlist-save branch 2 times, most recently from 4e0618e to f7ae625 Compare June 29, 2021 19:27
@darkdarkdragon darkdarkdragon force-pushed the it/playlist-save branch 4 times, most recently from 9f70115 to 9dd88db Compare July 6, 2021 20:56
Copy link
Contributor

@jailuthra jailuthra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before merge, would it be feasible to test it out in a local dev environment and/or staging, aside from the unit tests?

LGTM otherwise. Will let somebody else mark it as approved, as this is my first dive into this part of the codebase.

drivers/overwrite_queue.go Outdated Show resolved Hide resolved
drivers/overwrite_queue_test.go Show resolved Hide resolved
drivers/overwrite_queue.go Outdated Show resolved Hide resolved
drivers/overwrite_queue.go Outdated Show resolved Hide resolved
drivers/overwrite_queue.go Show resolved Hide resolved
server/broadcast_test.go Show resolved Hide resolved
server/push_test.go Show resolved Hide resolved
drivers/session_mock.go Outdated Show resolved Hide resolved
drivers/session_mock.go Outdated Show resolved Hide resolved
drivers/session_mock.go Outdated Show resolved Hide resolved
core/playlistmanager.go Outdated Show resolved Hide resolved
drivers/overwrite_queue.go Show resolved Hide resolved
drivers/overwrite_queue.go Show resolved Hide resolved
drivers/overwrite_queue.go Show resolved Hide resolved
drivers/overwrite_queue.go Outdated Show resolved Hide resolved
drivers/overwrite_queue.go Outdated Show resolved Hide resolved
drivers/session_mock.go Show resolved Hide resolved
Copy link
Member

@yondonfu yondonfu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚢

@darkdarkdragon darkdarkdragon merged commit bd8d45e into master Jul 22, 2021
@darkdarkdragon darkdarkdragon deleted the it/playlist-save branch July 22, 2021 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate "Error saving json playlist" errors.
3 participants