From 3db3ddff14e6e9787e590812050770129fb030cf Mon Sep 17 00:00:00 2001 From: malteish Date: Wed, 4 Sep 2024 12:50:24 +0200 Subject: [PATCH] await db write --- .../src/rpc/methods/handleSubmitMessage.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/delivery-service/src/rpc/methods/handleSubmitMessage.ts b/packages/delivery-service/src/rpc/methods/handleSubmitMessage.ts index cd3820ef4..46a6c9507 100644 --- a/packages/delivery-service/src/rpc/methods/handleSubmitMessage.ts +++ b/packages/delivery-service/src/rpc/methods/handleSubmitMessage.ts @@ -1,5 +1,9 @@ import { DeliveryServiceProperties } from '@dm3-org/dm3-lib-delivery'; -import { EncryptionEnvelop, schema } from '@dm3-org/dm3-lib-messaging'; +import { + EncryptionEnvelop, + getEnvelopSize, + schema, +} from '@dm3-org/dm3-lib-messaging'; import { DeliveryServiceProfileKeys } from '@dm3-org/dm3-lib-profile'; import { IWebSocketManager, @@ -71,7 +75,7 @@ export async function handleSubmitMessage( try { await messageProcessor.processEnvelop(envelop); - db.countMessage(envelop.message.size); + await db.countMessage(getEnvelopSize(envelop)); res.sendStatus(200); } catch (error) { console.error('handle submit message error');