Closed rubensworks closed 3 years ago
Thanks for reporting the issue @rubensworks ! In your case, which would make more sense: being able to disable the background refreshing altogether, or being able to clear the latest one, probably on user logout ? I think the former would be easy, but if the latter would be more useful to you, as long as the issue is not too disruptive I can investigate a bit more and come up with a cleaner solution.
which would make more sense: being able to disable the background refreshing altogether, or being able to clear the latest one, probably on user logout ?
As the former is the easiest solution, I guess that should be fine for my use case for now.
However, the manual clearing of timeouts on logout would also be useful in the long term. For example, I'm using this for query execution. So if there are long-running queries, there may be still a need for background refreshing. Once the query terminates, a manual clear/logout could then be done.
Well, it turns out that clearing things up on logout was easier than preventing the background refresh in the first place, because it demanded no API change :). Do let me know if preventing the background refresh altogether is still something that you'd require. You can test if this fixes your issue using @inrupt/solid-client-authn-node@fixnodeproactive-refresh
. I won't close the issue until the fix is properly released and you've confirmed that your issue is resolved :)
Thanks @NSeydoux! Will try it out soon.
Very minor error @rubensworks but you might like to rename the title from "exists" to "exits".
Oh, oops, you're right 😅
@NSeydoux The fix works like a charm, thanks for the quick fix!
I'm glad it works !
Search terms you've used
refresh, token, exit, hanging
Impacted package
Which packages do you think might be impacted by the bug ?
Bug description
When using this lib in a Node.js application, the Node.js will not gracefully exit anymore after logging in. This appears to be caused by the timeouts that are set to handle token refreshing, which obviously makes sense.
I was wondering if it would be possible to work around this, by for example
To Reproduce
I've created a small repo with a bin script that demonstrates the problem. After logging in, the Node process will hang.
Using a packages such as
why-is-node-running
, it can be observed that it is hanging because of the mentioned timeout handler.Environment
Please run
npx envinfo --system --npmPackages --binaries --npmGlobalPackages --browsers
in your project folder and paste the output here:
Additional information