Database schema optimization - part 13 (fixes #1882 fixes #2415)

This commit is contained in:
mdecimus
2025-11-25 12:14:51 +01:00
parent c7fc16d9a2
commit 2b614aa536
62 changed files with 1661 additions and 2264 deletions

View File

@@ -116,12 +116,10 @@ impl<T: SessionStream> Session<T> {
.caused_by(trc::location!())?;
// Write script blob
let blob_hash = self
let (blob_hash, blob_hold) = self
.server
.put_blob(account_id, &script_bytes, false)
.await
.caused_by(trc::location!())?
.hash;
.put_temporary_blob(account_id, &script_bytes, 60)
.await?;
// Write record
let mut batch = BatchBuilder::new();
@@ -141,7 +139,8 @@ impl<T: SessionStream> Session<T> {
.with_current(script)
.with_access_token(access_token),
)
.caused_by(trc::location!())?;
.caused_by(trc::location!())?
.clear(blob_hold);
self.server
.commit_batch(batch)
@@ -158,11 +157,10 @@ impl<T: SessionStream> Session<T> {
);
} else {
// Write script blob
let blob_hash = self
let (blob_hash, blob_hold) = self
.server
.put_blob(account_id, &script_bytes, false)
.await?
.hash;
.put_temporary_blob(account_id, &script_bytes, 60)
.await?;
// Write record
let mut batch = BatchBuilder::new();
@@ -184,7 +182,8 @@ impl<T: SessionStream> Session<T> {
)
.with_access_token(access_token),
)
.caused_by(trc::location!())?;
.caused_by(trc::location!())?
.clear(blob_hold);
self.server
.commit_batch(batch)