mirror of
https://github.com/status-im/nim-dagger.git
synced 2025-02-28 22:30:52 +00:00
- Update async procedures to use explicit raises annotation - Modify TrackedFutures to handle futures with no raised exceptions - Replace `asyncSpawn` with explicit future tracking - Update test suites to use `unittest2` - Standardize error handling across network and async components - Remove deprecated error handling patterns This commit introduces a more robust approach to async error handling and future management, improving type safety and reducing potential runtime errors.
32 lines
696 B
Nim
32 lines
696 B
Nim
import pkg/codex/streams/storestream
|
|
import pkg/unittest2
|
|
|
|
# From lip2p/tests/helpers
|
|
const trackerNames = [StoreStreamTrackerName]
|
|
|
|
iterator testTrackers*(extras: openArray[string] = []): TrackerBase =
|
|
for name in trackerNames:
|
|
let t = getTracker(name)
|
|
if not isNil(t):
|
|
yield t
|
|
for name in extras:
|
|
let t = getTracker(name)
|
|
if not isNil(t):
|
|
yield t
|
|
|
|
proc checkTracker*(name: string) =
|
|
var tracker = getTracker(name)
|
|
if tracker.isLeaked():
|
|
checkpoint tracker.dump()
|
|
fail()
|
|
|
|
proc checkTrackers*() =
|
|
for tracker in testTrackers():
|
|
if tracker.isLeaked():
|
|
checkpoint tracker.dump()
|
|
fail()
|
|
try:
|
|
GC_fullCollect()
|
|
except:
|
|
discard
|