Skip to content

Commit 4aca00d

Browse files
committed
editoast: async-pg smaller chunk size in persist_batch
1 parent 7b69c22 commit 4aca00d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

editoast/editoast_derive/src/infra_model.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ pub fn infra_model(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
3939
// Work around a diesel limitation
4040
// See https://github.com/diesel-rs/diesel/issues/2414
4141
// Divided by 3 here because we are inserting three values
42-
const DIESEL_MAX_VALUES : usize = (2_usize.pow(16) - 1)/3;
42+
// When using AsyncPgConnection, we divide must again
43+
// Maybe its related to connexion pipelining
44+
const DIESEL_MAX_VALUES : usize = (2_usize.pow(16) - 1)/3/2;
4345
for data_chunk in datas.chunks(DIESEL_MAX_VALUES) {
4446
diesel::insert_into(#table::table)
4547
.values(data_chunk)

0 commit comments

Comments
 (0)