From f4561d2c38b15b287fcf34b707ffa76250ab2040 Mon Sep 17 00:00:00 2001 From: Arnaud Date: Fri, 24 Apr 2026 17:56:07 +0400 Subject: [PATCH] Remove unused imports and fix warnings --- library/storage_context.nim | 4 ++-- .../requests/node_download_request.nim | 10 ++++------ .../requests/node_lifecycle_request.nim | 2 +- .../requests/node_storage_request.nim | 2 -- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/library/storage_context.nim b/library/storage_context.nim index cbb140af..c5eddd2b 100644 --- a/library/storage_context.nim +++ b/library/storage_context.nim @@ -8,7 +8,7 @@ {.pragma: callback, cdecl, raises: [], gcsafe.} {.passc: "-fPIC".} -import std/[options, locks, atomics] +import std/[locks, atomics] import chronicles import chronos import chronos/threadsync @@ -152,7 +152,7 @@ proc runStorage(ctx: ptr StorageContext) {.async: (raises: []).} = # synchronously until the first await asyncSpawn ( proc() {.async.} = - await sleepAsync(0) + await sleepAsync(0.milliseconds) await StorageThreadRequest.process(request, addr storage) )() diff --git a/library/storage_thread_requests/requests/node_download_request.nim b/library/storage_thread_requests/requests/node_download_request.nim index 44b38482..f0297bbe 100644 --- a/library/storage_thread_requests/requests/node_download_request.nim +++ b/library/storage_thread_requests/requests/node_download_request.nim @@ -15,13 +15,11 @@ ## the onChunk handler for each chunk and / or writing to a file if filepath is set. ## - CANCEL: cancels the download session -import std/[options, streams] import chronos import chronicles import libp2p/stream/[lpstream] import serde/json as serde import ../../alloc -import ../../../storage/units import ../../../storage/storagetypes from ../../../storage/storage import StorageServer, node @@ -185,7 +183,7 @@ proc streamData( while not stream.atEof: ## Yield immediately to the event loop ## It gives a chance to cancel request to be processed - await sleepAsync(0) + await sleepAsync(0.milliseconds) let read = await stream.readOnce(addr buf[0], buf.len) buf.setLen(read) @@ -213,7 +211,7 @@ proc stream( local: bool, filepath: cstring, onChunk: OnChunkHandler, -): Future[Result[string, string]] {.raises: [], async: (raises: []).} = +): Future[Result[string, string]] {.async: (raises: []).} = ## Stream the file identified by cid, calling the onChunk handler for each chunk ## and / or writing to a file if filepath is set. ## @@ -252,7 +250,7 @@ proc stream( proc cancel( storage: ptr StorageServer, cCid: cstring -): Future[Result[string, string]] {.raises: [], async: (raises: []).} = +): Future[Result[string, string]] {.async: (raises: []).} = ## Cancel the download session identified by cid. ## This operation is not supported when using the stream mode, ## because the worker will be busy downloading the file. @@ -280,7 +278,7 @@ proc cancel( proc manifest( storage: ptr StorageServer, cCid: cstring -): Future[Result[string, string]] {.raises: [], async: (raises: []).} = +): Future[Result[string, string]] {.async: (raises: []).} = let cid = Cid.init($cCid) if cid.isErr: return err("Failed to fetch manifest: cannot parse cid: " & $cCid) diff --git a/library/storage_thread_requests/requests/node_lifecycle_request.nim b/library/storage_thread_requests/requests/node_lifecycle_request.nim index 34f7c726..6638cb03 100644 --- a/library/storage_thread_requests/requests/node_lifecycle_request.nim +++ b/library/storage_thread_requests/requests/node_lifecycle_request.nim @@ -5,7 +5,7 @@ import std/[options, json, strutils, net, os] import codexdht/discv5/spr -import stew/shims/parseutils +import std/parseutils import contractabi/address import chronos import chronicles diff --git a/library/storage_thread_requests/requests/node_storage_request.nim b/library/storage_thread_requests/requests/node_storage_request.nim index 00ffc27b..b2343041 100644 --- a/library/storage_thread_requests/requests/node_storage_request.nim +++ b/library/storage_thread_requests/requests/node_storage_request.nim @@ -8,10 +8,8 @@ ## - SPACE: get the amount of space used by the local node. ## - EXISTS: check the existence of a cid in a node (local store). -import std/[options] import chronos import chronicles -import libp2p/stream/[lpstream] import serde/json as serde import ../../alloc import ../../../storage/units