fix(internaldata): stamp ended_at when the territory-drift check abandons an encounter - #33
Merged
Merged
Conversation
…dons an encounter
UpsertSightingAsync's territory-drift branch nulled mCurrentEncounterId
without stamping ended_at, unlike OnTerritoryChanged and the world-drift
branch immediately below it. A missed or late TerritoryChanged therefore
left the row dangling at ended_at IS NULL until the next session's orphan
sweep - and when that reload happened to land in the same territory, pass
1's unbounded crash-recovery branch resumed it and welded two unrelated
visits into one encounter with a bogus duration.
Both drift branches now feed a shared driftStampId slot. They are mutually
exclusive by construction: the territory branch nulls mCurrentEncounterId,
so the world branch's `mCurrentEncounterId is { } drifted` pattern can no
longer match afterwards.
Also add a one-shot warning to the watcher's ProcessAsync IsStopping bail.
That path returning silently is why the lifetime-token regression fixed in
NexusKit (Dalamud's load-timeout token being treated as the plugin
lifetime) went unnoticed for weeks: observation persistence died 60s into
every session, Recent and ObservationProcessed froze, and the nearby-player
list silently stopped growing with nothing in the log. On a legitimate
unload the warning fires at most once during teardown.
Docs: correct the "plugin unload leaves the encounter open" claim - the
Stopping transition now closes it cleanly, so only a hard crash leaves
ended_at NULL - and document both drift checks plus the
COUNT(*) WHERE ended_at IS NULL invariant.
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.
UpsertSightingAsync's territory-drift branch nulled mCurrentEncounterId
without stamping ended_at, unlike OnTerritoryChanged and the world-drift
branch immediately below it. A missed or late TerritoryChanged therefore
left the row dangling at ended_at IS NULL until the next session's orphan
sweep - and when that reload happened to land in the same territory, pass
1's unbounded crash-recovery branch resumed it and welded two unrelated
visits into one encounter with a bogus duration.
Both drift branches now feed a shared driftStampId slot. They are mutually
exclusive by construction: the territory branch nulls mCurrentEncounterId,
so the world branch's
mCurrentEncounterId is { } driftedpattern can nolonger match afterwards.
Also add a one-shot warning to the watcher's ProcessAsync IsStopping bail.
That path returning silently is why the lifetime-token regression fixed in
NexusKit (Dalamud's load-timeout token being treated as the plugin
lifetime) went unnoticed for weeks: observation persistence died 60s into
every session, Recent and ObservationProcessed froze, and the nearby-player
list silently stopped growing with nothing in the log. On a legitimate
unload the warning fires at most once during teardown.
Docs: correct the "plugin unload leaves the encounter open" claim - the
Stopping transition now closes it cleanly, so only a hard crash leaves
ended_at NULL - and document both drift checks plus the
COUNT(*) WHERE ended_at IS NULL invariant.