Skip to content

Location streaming fixes#8351

Open
link2xt wants to merge 2 commits into
mainfrom
link2xt/location-streaming-fixes
Open

Location streaming fixes#8351
link2xt wants to merge 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.

link2xt added 2 commits June 26, 2026 18:15
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 b34bc43 to c85e622 Compare June 26, 2026 18:15
@link2xt link2xt marked this pull request as ready for review June 26, 2026 18:24
@link2xt link2xt requested review from Hocuri, iequidoo and j-g00da June 27, 2026 14:34
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.

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