feat: enable dispatch event using single thread (#3828)

* refactor: lib dispatch

* chore: type def

* chore: type def

* fix: local set spawn

* chore: replace tokio spawn

* chore: update log

* chore: boxed event

* chore: tauri lock
This commit is contained in:
Nathan.fooo
2023-10-30 12:35:06 +08:00
committed by GitHub
parent 7f4e7e6aa0
commit e08a1a6974
67 changed files with 822 additions and 554 deletions

View File

@ -37,7 +37,7 @@ pub struct DatabaseEditorTest {
impl DatabaseEditorTest {
pub async fn new_grid() -> Self {
let sdk = EventIntegrationTest::new();
let sdk = EventIntegrationTest::new().await;
let _ = sdk.init_anon_user().await;
let params = make_test_grid();
@ -46,7 +46,7 @@ impl DatabaseEditorTest {
}
pub async fn new_no_date_grid() -> Self {
let sdk = EventIntegrationTest::new();
let sdk = EventIntegrationTest::new().await;
let _ = sdk.init_anon_user().await;
let params = make_no_date_test_grid();
@ -55,7 +55,7 @@ impl DatabaseEditorTest {
}
pub async fn new_board() -> Self {
let sdk = EventIntegrationTest::new();
let sdk = EventIntegrationTest::new().await;
let _ = sdk.init_anon_user().await;
let params = make_test_board();
@ -64,7 +64,7 @@ impl DatabaseEditorTest {
}
pub async fn new_calendar() -> Self {
let sdk = EventIntegrationTest::new();
let sdk = EventIntegrationTest::new().await;
let _ = sdk.init_anon_user().await;
let params = make_test_calendar();

View File

@ -14,6 +14,7 @@ use flowy_database2::entities::{CheckboxFilterConditionPB, CheckboxFilterPB, Che
use flowy_database2::services::database_view::DatabaseViewChanged;
use flowy_database2::services::field::SelectOption;
use flowy_database2::services::filter::FilterType;
use lib_dispatch::prelude::af_spawn;
use crate::database::database_editor::DatabaseEditorTest;
@ -278,7 +279,7 @@ impl DatabaseFilterTest {
if change.is_none() {return;}
let change = change.unwrap();
let mut receiver = self.recv.take().unwrap();
tokio::spawn(async move {
af_spawn(async move {
match tokio::time::timeout(Duration::from_secs(2), receiver.recv()).await {
Ok(changed) => {
match changed.unwrap() { DatabaseViewChanged::FilterNotification(notification) => {