mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-15 06:50:58 +00:00
fix(runtime): allow shared plugin reconcile to finish (#2419)
Co-authored-by: Chan <dadachann@users.noreply.github.com>
This commit is contained in:
@@ -1579,7 +1579,7 @@ class RuntimeConnectionHandler(handler.Handler):
|
|||||||
return await self.call_action(
|
return await self.call_action(
|
||||||
LangBotToRuntimeAction.RECONCILE_PLUGIN_INSTALLATIONS,
|
LangBotToRuntimeAction.RECONCILE_PLUGIN_INSTALLATIONS,
|
||||||
request.model_dump(),
|
request.model_dump(),
|
||||||
timeout=120,
|
timeout=300,
|
||||||
)
|
)
|
||||||
|
|
||||||
async def apply_plugin_installation(
|
async def apply_plugin_installation(
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ from types import SimpleNamespace
|
|||||||
from unittest.mock import AsyncMock, MagicMock, Mock
|
from unittest.mock import AsyncMock, MagicMock, Mock
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from langbot_plugin.entities.io.actions.enums import PluginToRuntimeAction
|
from langbot_plugin.entities.io.actions.enums import LangBotToRuntimeAction, PluginToRuntimeAction
|
||||||
from langbot_plugin.entities.io.context import ActionContext, InstallationBinding
|
from langbot_plugin.entities.io.context import ActionContext, InstallationBinding, PluginInstallationDesiredState
|
||||||
|
|
||||||
|
|
||||||
def make_handler(app):
|
def make_handler(app):
|
||||||
@@ -67,6 +67,20 @@ def make_handler(app):
|
|||||||
return runtime_handler
|
return runtime_handler
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_reconcile_plugin_installations_allows_cloud_cold_start_to_finish():
|
||||||
|
app = SimpleNamespace()
|
||||||
|
runtime_handler = make_handler(app)
|
||||||
|
runtime_handler.call_action = AsyncMock(return_value={})
|
||||||
|
binding = next(iter(runtime_handler._installation_bindings.values()))[0]
|
||||||
|
desired = PluginInstallationDesiredState(binding=binding, enabled=True)
|
||||||
|
|
||||||
|
await runtime_handler.reconcile_plugin_installations((desired,))
|
||||||
|
|
||||||
|
assert runtime_handler.call_action.await_args.args[0] == LangBotToRuntimeAction.RECONCILE_PLUGIN_INSTALLATIONS
|
||||||
|
assert runtime_handler.call_action.await_args.kwargs['timeout'] == 300
|
||||||
|
|
||||||
|
|
||||||
class TestHandlerQueryVariables:
|
class TestHandlerQueryVariables:
|
||||||
"""Tests for handler query variable logic."""
|
"""Tests for handler query variable logic."""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user