Print time of every SQLiteStore operation

This commit is contained in:
Bulat-Ziganshin 2022-09-08 05:02:17 +03:00
parent ba42533ad6
commit 38ffb990e8
1 changed files with 7 additions and 0 deletions

View File

@ -75,6 +75,8 @@ method getBlock*(
## Save a copy to the cache if present in the database but not in the cache ## Save a copy to the cache if present in the database but not in the cache
## ##
notice " == getBlock"
if not self.cache.isNil: if not self.cache.isNil:
trace "Getting block from cache or database", cid trace "Getting block from cache or database", cid
else: else:
@ -191,6 +193,7 @@ method hasBlock*(
## Check if a block exists in the database ## Check if a block exists in the database
## ##
notice " == hasBlock"
trace "Checking database for block existence", cid trace "Checking database for block existence", cid
if cid.isEmpty: if cid.isEmpty:
@ -234,6 +237,8 @@ method listBlocks*(
## This is an intensive operation ## This is an intensive operation
## ##
notice "== List started =="
for id in self.listBlocksQuery(): for id in self.listBlocksQuery():
let let
# keys stored in id column of SQLiteDatastore are serialized Key # keys stored in id column of SQLiteDatastore are serialized Key
@ -245,6 +250,8 @@ method listBlocks*(
else: else:
trace "Unable to construct CID from key", key = id, error = $cidRes.error trace "Unable to construct CID from key", key = id, error = $cidRes.error
notice "== List finished"
return success() return success()
method close*(self: SQLiteStore): Future[void] {.async.} = method close*(self: SQLiteStore): Future[void] {.async.} =