zixaphir / Stable-Diffusion-Webui-Civitai-Helper

Stable Diffusion Webui Extension for Civitai, to manage your model much more easily.
175 stars 24 forks source link

Request to Treat "503: Service Unavailable" as Successful Completion After a Certain Number of Occurrences #60

Closed NaokiSato102 closed 1 month ago

NaokiSato102 commented 6 months ago

I would like to request that when the "503: Service Unavailable" error occurs more than a specified number of times, it should be treated as a normal process and present the failure accordingly. It is important to properly catch exceptions that are easy to foresee. Misinterpreting it as an unexpected error can hinder problem resolution.

zixaphir commented 6 months ago

I do not understand what you are proposing. Please provide additional context such as the steps taken to produce this issue, the expected behavior, and anything else that can help me understand what the issue is.

Rinual commented 6 months ago

I do not understand what you are proposing. Please provide additional context such as the steps taken to produce this issue, the expected behavior, and anything else that can help me understand what the issue is.

Civitai Helper: GET Request failed with error code:
   503: Service Unavailable
Civitai Helper: Retrying
Civitai Helper: GET Request failed with error code:
   503: Service Unavailable
Civitai Helper: Retrying
Civitai Helper: GET Request failed with error code:
   503: Service Unavailable
Civitai Helper: Retrying
Civitai Helper: GET Request failed with error code:
   503: Service Unavailable
Traceback (most recent call last):
  File "E:\Auto1111\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
    output = await app.get_blocks().process_api(
  File "E:\Auto1111\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
    result = await self.call_function(
  File "E:\Auto1111\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1117, in call_function
    prediction = await utils.async_iteration(iterator)
  File "E:\Auto1111\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 350, in async_iteration
    return await iterator.__anext__()
  File "E:\Auto1111\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 343, in __anext__
    return await anyio.to_thread.run_sync(
  File "E:\Auto1111\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "E:\Auto1111\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "E:\Auto1111\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
    result = context.run(func, *args)
  File "E:\Auto1111\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 326, in run_sync_iterator_async
    return next(iterator)
  File "E:\Auto1111\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 695, in gen_wrapper
    yield from f(*args, **kwargs)
  File "E:\Auto1111\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\ch_lib\model_action_civitai.py", line 162, in scan_model
    for result in scan_single_model(filepath, model_type, refetch_old, delay):
  File "E:\Auto1111\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\ch_lib\model_action_civitai.py", line 90, in scan_single_model
    model_info = civitai.get_model_info_by_hash(sha256_hash)
  File "E:\Auto1111\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\ch_lib\civitai.py", line 117, in get_model_info_by_hash
    content = append_parent_model_metadata(content)
  File "E:\Auto1111\stable-diffusion-webui\extensions\Stable-Diffusion-Webui-Civitai-Helper\scripts\ch_lib\civitai.py", line 86, in append_parent_model_metadata
    content["creator"] = parent_model.get("creator", "{}")
AttributeError: 'NoneType' object has no attribute 'get'

If I read the OP correctly, and I'm reading my own error correctly, while using the scan to to update metadata, if their is a 503 error, it kills the rest of the scan instead of handling the exception and allowing the rest of the scan to complete.

currently i stopped being able to scan all models, and even models i download with civitai directly from URL, many only finished the .safetensors part of the DL and never made the json or preview image part and dies on re-scan.

it working for so long prior to this makes me think its something on civitai's side that changed, with how buggy everything has been on their site. Possibly cloudfare for DDOS protection getting connections dropped?

Yaeph commented 6 months ago

same

DivanoDova commented 6 months ago

It's broken can't download anything, if i'm lucky i can get 1 files with a lot of try.

NaokiSato102 commented 6 months ago

I cannot replicate the error anymore, so it's difficult to say, but I believe it was something like this. Since it's the same issue with the 503 series, it would be good if we can resolve #62 along with it.

zixaphir commented 1 month ago

I believe this has been resolved. I apologize for not updating this issue