Defer asset_seeder resume until GC interval elapses
Some checks are pending
Python Linting / Run Pylint (push) Waiting to run
Python Linting / Run Ruff (push) Waiting to run
Build package / Build Test (3.10) (push) Waiting to run
Build package / Build Test (3.11) (push) Waiting to run
Build package / Build Test (3.12) (push) Waiting to run
Build package / Build Test (3.13) (push) Waiting to run
Build package / Build Test (3.14) (push) Waiting to run

Only resume the asset scanner when the needs_gc time condition is
satisfied, preventing the scanner from restarting between rapid
successive prompt executions.

Amp-Thread-ID: https://ampcode.com/threads/T-019cc637-2352-7139-b753-47c19f43b55c
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Luke Mino-Altherr 2026-03-06 18:55:44 -08:00
parent f1188f1d5f
commit b865772597

View File

@ -261,12 +261,8 @@ def prompt_worker(q, server_instance):
for k in sensitive: for k in sensitive:
extra_data[k] = sensitive[k] extra_data[k] = sensitive[k]
was_paused = asset_seeder.pause() asset_seeder.pause()
try:
e.execute(item[2], prompt_id, extra_data, item[4]) e.execute(item[2], prompt_id, extra_data, item[4])
finally:
if was_paused:
asset_seeder.resume()
need_gc = True need_gc = True
remove_sensitive = lambda prompt: prompt[:5] + prompt[6:] remove_sensitive = lambda prompt: prompt[:5] + prompt[6:]
@ -310,6 +306,7 @@ def prompt_worker(q, server_instance):
last_gc_collect = current_time last_gc_collect = current_time
need_gc = False need_gc = False
hook_breaker_ac10a0.restore_functions() hook_breaker_ac10a0.restore_functions()
asset_seeder.resume()
async def run(server_instance, address='', port=8188, verbose=True, call_on_start=None): async def run(server_instance, address='', port=8188, verbose=True, call_on_start=None):