mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-04 23:17:20 +08:00
refactor: own cross-thread background tasks
This commit is contained in:
@@ -34,6 +34,7 @@ def test_owner_gate_tracks_known_registry_without_matching_same_named_methods(
|
||||
task_registry.create(work())
|
||||
resolve_registry(task_registry).create_sync(work, owner=dynamic_owner)
|
||||
get_task_registry().register(task, owner=" ")
|
||||
task_registry.submit_threadsafe(work(), loop=loop)
|
||||
""",
|
||||
)
|
||||
|
||||
@@ -41,11 +42,13 @@ def test_owner_gate_tracks_known_registry_without_matching_same_named_methods(
|
||||
"create",
|
||||
"create_sync",
|
||||
"register",
|
||||
"submit_threadsafe",
|
||||
]
|
||||
assert [violation.reason for violation in violations] == [
|
||||
"缺少显式 owner",
|
||||
"的 owner 必须是非空字符串字面量",
|
||||
"的 owner 必须是非空字符串字面量",
|
||||
"缺少显式 owner",
|
||||
]
|
||||
|
||||
|
||||
@@ -65,6 +68,11 @@ def test_owner_gate_accepts_aliases_and_stable_literal_owners(tmp_path: Path) ->
|
||||
task,
|
||||
owner="api.example.existing",
|
||||
)
|
||||
task_registry.submit_threadsafe(
|
||||
work(),
|
||||
loop=loop,
|
||||
owner="api.example.threadsafe",
|
||||
)
|
||||
""",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user