mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
Decode DAML-LF retrieved from the database in the server thread pool (#4655)
This relieves the database thread pool from work it's not supposed to do. CHANGELOG_BEGIN CHANGELOG_END
This commit is contained in:
parent
4a8c5cf24e
commit
1b23be6cc3
@ -1503,14 +1503,16 @@ private class JdbcLedgerDao(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override def getLfArchive(packageId: PackageId): Future[Option[Archive]] =
|
override def getLfArchive(packageId: PackageId): Future[Option[Archive]] =
|
||||||
dbDispatcher.executeSql("load_archive", Some(s"pkg id: $packageId")) { implicit conn =>
|
dbDispatcher
|
||||||
SQL_SELECT_PACKAGE
|
.executeSql("load_archive", Some(s"pkg id: $packageId")) { implicit conn =>
|
||||||
.on(
|
SQL_SELECT_PACKAGE
|
||||||
"package_id" -> packageId
|
.on(
|
||||||
)
|
"package_id" -> packageId
|
||||||
.as[Option[Array[Byte]]](SqlParser.byteArray("package").singleOpt)
|
)
|
||||||
.map(data => Archive.parseFrom(Decode.damlLfCodedInputStreamFromBytes(data)))
|
.as[Option[Array[Byte]]](SqlParser.byteArray("package").singleOpt)
|
||||||
}
|
}
|
||||||
|
.map(_.map(data => Archive.parseFrom(Decode.damlLfCodedInputStreamFromBytes(data))))(
|
||||||
|
executionContext)
|
||||||
|
|
||||||
private val SQL_INSERT_PACKAGE_ENTRY_ACCEPT =
|
private val SQL_INSERT_PACKAGE_ENTRY_ACCEPT =
|
||||||
SQL("""insert into package_entries(ledger_offset, recorded_at, submission_id, typ)
|
SQL("""insert into package_entries(ledger_offset, recorded_at, submission_id, typ)
|
||||||
|
Loading…
Reference in New Issue
Block a user