fix: make create_send_msg_jobs actually return row IDs - #8585
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
20ae3c5 to
889578d
Compare
1ca89ff to
e657a72
Compare
| chat1.send_msg_sync(msg1) | ||
|
|
||
| lp.sec("ac2: receive message") | ||
| msg_in = ac2._evtracker.wait_next_incoming_message() |
There was a problem hiding this comment.
The test gets stuck without the fix, likely here because the message is never sent out as it tries to send rowid 1 from smtp table.
|
Ended up writing a python test for dc_send_msg_sync() because it is the only API that is affected and only exists as CFFI. IIRC it is used by iOS for share extension. |
| sent_id = lib.dc_send_msg_sync(self.account._dc_context, self.id, msg._dc_msg) | ||
| if sent_id == 0: | ||
| raise ValueError("message could not be sent") | ||
| # modify message in place to avoid bad state for the caller |
There was a problem hiding this comment.
This code is copy-pasted from a function above.
hpk42
left a comment
There was a problem hiding this comment.
looks good enough (see review comments). Also i think it'd be good to have an offline Rust test queuing two messages and testing the row-id behaviour.
| if sent_msg is None: | ||
| raise ValueError("cannot load just sent message from the database") | ||
| msg._dc_msg = sent_msg._dc_msg | ||
| return msg |
There was a problem hiding this comment.
this is almost complete duplication. except for one different lib call. Please consider avoiding it.
There was a problem hiding this comment.
Deduplicated it for these two functions with _reload_sent_msg. There are other functions like send_text etc. but they don't take existing message as an input, so don't need to modify it in place.
It is not called from outside the "chat" module.
.execute() was returning the number of rows, so usually 1. .insert() is returning the row ID. In most cases it does not matter because the result is checked with .is_empty(), but send_msg_sync() actually uses the row IDs.
e657a72 to
a67a5b0
Compare
I tried to do it before writing a python test, but |
.execute() was returning the number of rows, so usually 1.
.insert() is returning the row ID.
In most cases it does not matter because the result is checked with .is_empty(), but send_msg_sync() actually uses the row IDs.