Replies: 1 comment
-
Side note: using context.Background() instead solves this. Something makes me feel like the Client.Del should allow me to ignore the context though... Thoughts? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I'm fairly new to golang and would love some advice.
I have an app with main.go, one.go, and contextUtil.go.
In main.go
In one.go I run some logic that just calls
defer contextUtil.AnkaDelete(ctx, vmName)
anddefer contextUtil.RemoveUniqueKeyFromDB(ctx)
In contextUtil.go:
I can issue ctrl+c to trigger the interrupt and it starts doing the defers from one.go. However,
database.Client.Del
throwscontext canceled
and never deletes the key from the database. I've confirmeddatabase.UniqueRunKey
is right. My only thought is thatdatabase.Client.Del
is respecting the main'scancel
that's sent. I need to prevent that so that certain things ALWAYS run before the process exists.Am I missing anything? I'm guessing I can just send in a different
ctx
/context todatabase.Client.Del
to solve this, but wanted to see if I'm thinking about this incorrectly and there is a better way.Beta Was this translation helpful? Give feedback.
All reactions