Skip to content

Commit

Permalink
Allow more concurrent skip calls.
Browse files Browse the repository at this point in the history
  • Loading branch information
dowlandaiello committed Oct 14, 2024
1 parent 107e1b4 commit 8f9bfef
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions local-interchaintest/tests/transfer_neutron.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import json
import asyncio
from asyncio import Lock
from asyncio import Semaphore
from typing import Any
from src.strategies.util import transfer_raw
from src.scheduler import Ctx
from src.scheduler import Ctx, MAX_SKIP_CONCURRENT_CALLS
from src.util import try_multiple_clients
from src.util import custom_neutron_network_config
import aiohttp
Expand Down Expand Up @@ -49,7 +49,7 @@ async def main() -> None:
denoms,
{},
{},
Lock(),
Semaphore(MAX_SKIP_CONCURRENT_CALLS),
)

await transfer_raw(
Expand Down
6 changes: 3 additions & 3 deletions local-interchaintest/tests/transfer_osmosis.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import json
from asyncio import Lock
from asyncio import Semaphore
import asyncio
from typing import Any
from src.strategies.util import transfer_raw
from src.scheduler import Ctx
from src.scheduler import Ctx, MAX_SKIP_CONCURRENT_CALLS
from src.util import try_multiple_clients
from src.util import custom_neutron_network_config
import aiohttp
Expand Down Expand Up @@ -49,7 +49,7 @@ async def main() -> None:
denoms,
{},
{},
Lock(),
Semaphore(MAX_SKIP_CONCURRENT_CALLS),
)

await transfer_raw(
Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Implements a command-line interface for running arbitrage strategies.
"""

from asyncio import Lock
from asyncio import Semaphore
import traceback
import asyncio
from multiprocessing import Process
Expand Down Expand Up @@ -215,7 +215,7 @@ async def main() -> None:
chain_id: load_chain_info(info)
for (chain_id, info) in denom_file["chain_info"].items()
},
Lock(),
Semaphore(),
).recover_history()
sched = Scheduler(ctx, strategy)

Expand Down
4 changes: 2 additions & 2 deletions src/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Implements a strategy runner with an arbitrary provider set in an event-loop style.
"""

from asyncio import Lock
from asyncio import Semaphore
import logging
from datetime import datetime
import json
Expand Down Expand Up @@ -62,7 +62,7 @@ class Ctx(Generic[TState]):
denom_map: dict[str, list[DenomChainInfo]]
denom_routes: dict[str, dict[str, list[DenomRouteLeg]]]
chain_info: dict[str, ChainInfo]
http_session_lock: Lock
http_session_lock: Semaphore

def with_state(self, state: Any) -> Self:
"""
Expand Down
6 changes: 3 additions & 3 deletions tests/util.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from asyncio import Lock
from asyncio import Semaphore
from typing import Any, cast, AsyncIterator
import json
import aiohttp
from dataclasses import dataclass
from contextlib import asynccontextmanager
from cosmpy.aerial.client import LedgerClient, NetworkConfig
from cosmpy.aerial.wallet import LocalWallet
from src.scheduler import Ctx
from src.scheduler import Ctx, MAX_SKIP_CONCURRENT_CALLS
from src.util import (
DISCOVERY_CONCURRENCY_FACTOR,
NEUTRON_NETWORK_CONFIG,
Expand Down Expand Up @@ -109,5 +109,5 @@ async def ctx() -> AsyncIterator[Ctx[Any]]:
denom_map={},
denom_routes={},
chain_info={},
http_session_lock=Lock(),
http_session_lock=Semaphore(MAX_SKIP_CONCURRENT_CALLS),
).with_state(State(1000))

0 comments on commit 8f9bfef

Please sign in to comment.