Repository navigation
Load no chat's log when a window drops its subscriptions - #545
Merged
Merged
Conversation
dropSubs and chatUnsubscribe removed a sink with chat.do, which loads the chat first, so a window going opened every restored chat's events.jsonl. On Windows the logs still open when the test's TempDir cleanup ran made TestChatBootLoadsNothing fail about every other run. Both now use run. A closed chat also marks itself loaded, so a do queued behind its close cannot reopen the log. TestChatBootLoadsNothing now drops a window's subscriptions and stops the daemon, and checks no other chat's log opened, on every OS.
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.
TestChatBootLoadsNothingfailed on windows-test (daemon-ah) about every other run since v0.3.5. TempDir cleanup could not delete some other chat'sevents.jsonlbecause it was still open. The cause was a real daemon bug, and it happened on every OS. Windows was just the only one that refused to delete an open file.Cause
#537 made
dropSubs(a window going) andchatUnsubscriberemove a subscriber withchat.do.doloads the chat first, so when the window closed, the daemon opened the log of every restored chat (199 of them in this test) to delete a map key. Those logs stayed open until shutdown.dropSubsruns in the client's reader goroutine, andServedoesn't wait for that goroutine, so it raced the test'sstop(). Any log it opened after its chat closed was never closed.Changes
dropSubsandchatUnsubscribeusechat.run, which removes the subscriber without loading the log.loaded, so adothat lands between the cleanup andclose(c.quit)can't reopen the log.TestChatBootLoadsNothingnow drops a window's subscriptions, unsubscribes one chat, stops the daemon, and checks after each step that no other chat'sevents.jsonlexists. Without the fix it fails on Linux, listing all 199 other chats.Verification
go test ./internal/daemon -run 'TestChatBootLoadsNothing$' -count=50passes. Before the fix it failed on every run.go test -raceon that test plus the subscribe, unsubscribe and archive tests,-count=20, passes.gofmt,go vet ./...andgo test ./...pass.