From 215d3344006b9168a8501d991ff259f8e4e71fb5 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Wed, 20 Sep 2023 17:29:25 -0600 Subject: [PATCH] avoid segfault on fullcollect --- tests/datastore/testthreadproxyds.nim | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/tests/datastore/testthreadproxyds.nim b/tests/datastore/testthreadproxyds.nim index 528a3e7..e81a235 100644 --- a/tests/datastore/testthreadproxyds.nim +++ b/tests/datastore/testthreadproxyds.nim @@ -140,9 +140,6 @@ suite "Test ThreadDatastore cancelations": sqlStore: Datastore ds: ThreadDatastore taskPool: Taskpool - key = Key.init("/a/b").tryGet() - bytes = "some bytes".toBytes - otherBytes = "some other bytes".toBytes privateAccess(ThreadDatastore) # expose private fields privateAccess(TaskCtx) # expose private fields @@ -153,7 +150,7 @@ suite "Test ThreadDatastore cancelations": ds = ThreadDatastore.new(sqlStore, tp = taskPool).tryGet() teardown: - GC_fullCollect() + GC_fullCollect() # run full collect after each test teardownAll: (await ds.close()).tryGet() @@ -169,8 +166,6 @@ suite "Test ThreadDatastore cancelations": signal: signal) fut = newFuture[void]("signalMonitor") threadArgs = (addr ctx, addr fut) - - var thread: Thread[type threadArgs] proc threadTask(args: type threadArgs) = @@ -191,6 +186,7 @@ suite "Test ThreadDatastore cancelations": check: fut.cancelled check: ctx.signal.close().isOk + fut = nil test "Should monitor and not cancel": var @@ -202,8 +198,6 @@ suite "Test ThreadDatastore cancelations": signal: signal) fut = newFuture[void]("signalMonitor") threadArgs = (addr ctx, addr fut) - - var thread: Thread[type threadArgs] proc threadTask(args: type threadArgs) = @@ -224,3 +218,4 @@ suite "Test ThreadDatastore cancelations": check: not fut.cancelled check: ctx.signal.close().isOk + fut = nil