Skip to content

fix: make create_send_msg_jobs actually return row IDs - #8585

Open
link2xt wants to merge 2 commits into
mainfrom
link2xt/create_send_msg_jobs-row_id
Open

fix: make create_send_msg_jobs actually return row IDs#8585
link2xt wants to merge 2 commits into
mainfrom
link2xt/create_send_msg_jobs-row_id

Conversation

@link2xt

@link2xt link2xt commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator

.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.

@link2xt

This comment was marked as outdated.

@link2xt
link2xt force-pushed the link2xt/create_send_msg_jobs-row_id branch from 20ae3c5 to 889578d Compare August 14, 2026 11:40
@link2xt link2xt mentioned this pull request Aug 22, 2026
@link2xt
link2xt force-pushed the link2xt/create_send_msg_jobs-row_id branch 2 times, most recently from 42ebbff to 1ca89ff Compare August 23, 2026 02:37
.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.
@link2xt
link2xt force-pushed the link2xt/create_send_msg_jobs-row_id branch from 1ca89ff to e657a72 Compare August 25, 2026 14:08
@link2xt
link2xt marked this pull request as ready for review August 25, 2026 14:08
chat1.send_msg_sync(msg1)

lp.sec("ac2: receive message")
msg_in = ac2._evtracker.wait_next_incoming_message()

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.

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.

@link2xt

link2xt commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator Author

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

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.

This code is copy-pasted from a function above.

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.

1 participant