New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config locks #2654
Config locks #2654
Conversation
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
# Conflicts: # redbot/core/config.py
…scordBot into V3/config_locks
Signed-off-by: Toby <tobyharradine@gmail.com>
Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
I've not found any other issues. I also looked through (did not manually test each of) the other places we already use config as a context manager to see if I could spot anywhere this might turn into a deadlock which wasn't before (though this would have indicated that section was problematic for the things this aims to help mitigate) and didn't spot any.
Definitely want to see if we can get this onto some of our larger ambassador bots without issue for testing if we have willing victims participants
This provides a way to lock by individual value, at any level of the config hierarchy desired.
Uses a weakref dictionary to maintain locks across multiple
Value
objects whilst they're simultaneously alive.This also updates the
async with config.foo()
context manager to use thefoo
value's lock, unless a newacquire_lock
kwarg is set toFalse
for some edge case where acquiring the lock is undesirable.