Skip to content

Location streaming fixes#8351

Merged
link2xt merged 2 commits into
mainfrom
link2xt/location-streaming-fixes
Jul 1, 2026
Merged

Location streaming fixes#8351
link2xt merged 2 commits into
mainfrom
link2xt/location-streaming-fixes

Conversation

@link2xt

@link2xt link2xt commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Base for #8345
Location streaming fixes split out of the branch.

Comment thread src/location.rs
let last_sent = alice
.sql
.query_row(
"SELECT locations_last_sent FROM chats WHERE id = ?",

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I have not found a better way to test this change. The fix avoids missing locations in a corner case of location arriving right after rendering the message and before evaluating now(), but is in fact mostly a refactoring to avoid passing unused location ID around. This is why the test is basically an implementation test.

Comment thread src/location.rs
AND (timestamp>? OR \
timestamp=(SELECT MAX(timestamp) FROM locations WHERE from_id=?)) \
AND independent=0 \
GROUP BY timestamp \

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not related to this PR, but this takes an arbitrary row if there are rows with the same timestamp, see https://sqlite.org/lang_select.html#generation_of_the_set_of_result_rows:

[...] If the expression is an aggregate expression, it is evaluated across all rows in the group. Otherwise, it is evaluated against a single arbitrarily chosen row from within the group.

I think instead of GROUP BY it should be ORDER BY timestamp, id DESC, then we can skip a row (in Rust) if timestamp is the same as in the previous iteration. Otherwise we can even send different locations in different chats or messages sent in a row to the same chat.

link2xt added 2 commits June 30, 2026 15:53
Stored location ID was not actually used
and locations_last_sent timestamp was updated
with the current time, possibly skipping
locations.
@link2xt link2xt force-pushed the link2xt/location-streaming-fixes branch from c85e622 to 908b761 Compare June 30, 2026 15:53
@link2xt link2xt merged commit 30bdcd6 into main Jul 1, 2026
31 checks passed
@link2xt link2xt deleted the link2xt/location-streaming-fixes branch July 1, 2026 12:02
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.

3 participants