mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-27 16:21:28 +00:00
🐛 fix cache concurrency
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
from nonebot import on_command
|
||||
from nonebot.log import logger
|
||||
from nonebot.dependencies import Depends
|
||||
from nonebot import on_command, on_message
|
||||
|
||||
test = on_command("123")
|
||||
|
||||
|
||||
def depend(state: dict):
|
||||
print("==== depends running =====")
|
||||
return state
|
||||
|
||||
|
||||
@ -13,5 +14,15 @@ def depend(state: dict):
|
||||
@test.got("b", prompt="b")
|
||||
@test.receive()
|
||||
@test.got("c", prompt="c")
|
||||
async def _(state: dict = Depends(depend)):
|
||||
logger.info(f"=======, {state}")
|
||||
async def _(x: dict = Depends(depend)):
|
||||
logger.info(f"=======, {x}")
|
||||
|
||||
|
||||
test_cache1 = on_message()
|
||||
test_cache2 = on_message()
|
||||
|
||||
|
||||
@test_cache1.handle()
|
||||
@test_cache2.handle()
|
||||
async def _(x: dict = Depends(depend)):
|
||||
logger.info(f"======= test, {x}")
|
||||
|
Reference in New Issue
Block a user