mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-20 17:29:08 +08:00
fix: block call to flask_app
This commit is contained in:
parent
e77cd87842
commit
c9eb9c14d7
@ -72,6 +72,8 @@ class PluginMigration:
|
|||||||
except Exception:
|
except Exception:
|
||||||
logger.exception(f"Failed to process tenant {tenant_id}")
|
logger.exception(f"Failed to process tenant {tenant_id}")
|
||||||
|
|
||||||
|
futures = []
|
||||||
|
|
||||||
while current_time < ended_at:
|
while current_time < ended_at:
|
||||||
click.echo(click.style(f"Current time: {current_time}, Started at: {datetime.datetime.now()}", fg="white"))
|
click.echo(click.style(f"Current time: {current_time}, Started at: {datetime.datetime.now()}", fg="white"))
|
||||||
# Initial interval of 1 day, will be dynamically adjusted based on tenant count
|
# Initial interval of 1 day, will be dynamically adjusted based on tenant count
|
||||||
@ -129,13 +131,19 @@ class PluginMigration:
|
|||||||
logger.exception(f"Failed to process tenant {tenant_id}")
|
logger.exception(f"Failed to process tenant {tenant_id}")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Process batch with thread pool
|
futures.append(
|
||||||
thread_pool.map(lambda tenant_id: process_tenant(current_app, tenant_id), tenants)
|
thread_pool.submit(
|
||||||
|
process_tenant,
|
||||||
|
current_app._get_current_object(), # type: ignore[attr-defined]
|
||||||
|
tenant_id,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
current_time = batch_end
|
current_time = batch_end
|
||||||
|
|
||||||
# wait for all threads to finish
|
# wait for all threads to finish
|
||||||
thread_pool.shutdown(wait=True)
|
for future in futures:
|
||||||
|
future.result()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def extract_installed_plugin_ids(cls, tenant_id: str) -> Sequence[str]:
|
def extract_installed_plugin_ids(cls, tenant_id: str) -> Sequence[str]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user