-
-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It's possible to have several drafts per one chat #6036
Labels
bug
Something is not working
Comments
Maybe increasing number of worker threads will help reproduce this, currently |
But even from the code, checking for existing draft and setting a new one happens in different SQL transactions, that's a bug. |
Made a test that fails: #[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_only_one_draft_per_chat() -> Result<()> {
let t = TestContext::new_alice().await;
let chat_id = create_group_chat(&t, ProtectionStatus::Unprotected, "abc").await?;
let mut msgs: Vec<message::Message> = (1..=1000).map(|i| {
let mut msg = Message::new(Viewtype::Text);
msg.set_text(i.to_string());
return msg;
}).collect();
let mut tasks = Vec::new();
for mut msg in msgs {
let ctx = t.clone();
let task = tokio::spawn(async move {
let ctx = ctx;
chat_id.set_draft(&ctx, Some(&mut msg)).await
});
tasks.push(task);
}
futures::future::join_all(tasks.into_iter()).await;
assert!(chat_id.get_draft(&t).await?.is_some());
chat_id.set_draft(&t, None).await?;
assert!(chat_id.get_draft(&t).await?.is_none());
Ok(())
} |
Made a fix #6052 |
WofWca
added a commit
to deltachat/deltachat-desktop
that referenced
this issue
Nov 10, 2024
The feature was introduced in cd80587. With several performance improvements to `jumpToMessage`, the fix to deltachat/deltachat-core-rust#6036, and some testing, it's time to release it.
WofWca
added a commit
to deltachat/deltachat-desktop
that referenced
this issue
Nov 10, 2024
The feature was introduced in cd80587. With several performance improvements to `jumpToMessage`, the fix to deltachat/deltachat-core-rust#6036, and some testing, it's time to release it.
WofWca
added a commit
to deltachat/deltachat-desktop
that referenced
this issue
Nov 10, 2024
The feature was introduced in cd80587. With several performance improvements to `jumpToMessage`, the fix to deltachat/deltachat-core-rust#6036, and some testing, it's time to release it.
WofWca
added a commit
to deltachat/deltachat-desktop
that referenced
this issue
Nov 14, 2024
The feature was introduced in cd80587. With several performance improvements to `jumpToMessage`, the fix to deltachat/deltachat-core-rust#6036, and some testing, it's time to release it.
WofWca
added a commit
to deltachat/deltachat-desktop
that referenced
this issue
Nov 14, 2024
The feature was introduced in cd80587. With several performance improvements to `jumpToMessage`, the fix to deltachat/deltachat-core-rust#6036, and some testing, it's time to release it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Operating System (Linux/Mac/Windows/iOS/Android): Linux
Delta Chat Version: Desktop 3bd0c73bcbff864151bf780d4987c2d9330178ca
Expected behavior:
await exp.rpc.getDraft()
should evaluate tonull
afterawait exp.rpc.removeDraft()
.Actual behavior:
A draft is still present after
await exp.rpc.removeDraft()
Steps to reproduce the problem:
Start Delta Chat desktop in dev mode with
pnpm -w dev:electron
.Create a chat, and learn its ID.
Open the console and paste the following:
You can execute
a few more times and you'll that
draft
is notnull
until you clear all the drafts.Screenshots:
https://github.com/user-attachments/assets/02ef2c06-ed75-4152-9cc2-a24cdd94c602
Logs:
Judging from API (
miscSetDraft
,removeDraft
), it looks like we're only supposed to have one draft.This could be what is causing deltachat/deltachat-desktop#3586 and deltachat/deltachat-desktop#3965 (comment)
Where to start looking:
deltachat-core-rust/src/chat.rs
Lines 921 to 948 in 8a88479
I tried to write a failing test, but it's actually passing:
The text was updated successfully, but these errors were encountered: