forked from boocmp/go-stt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
163 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .ipc_server import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import asyncio | ||
|
||
from utils.ipc.client import Publisher, Subscriber | ||
from utils.ipc import messages | ||
from ipc_server import run_ipc_server | ||
|
||
|
||
async def publisher(pair): | ||
async def op(): | ||
async with Publisher(pair) as pipe: | ||
for i in range(0, 30): | ||
await pipe.push(messages.Text(f"{pair} -> {i}", False)) | ||
await asyncio.sleep(1) | ||
|
||
try: | ||
await asyncio.wait_for(op(), 3) | ||
except Exception as e: | ||
print(e) | ||
pass | ||
|
||
|
||
async def subscriber(pair): | ||
try: | ||
async with Subscriber(pair) as pipe: | ||
while True: | ||
r = await pipe.pull() | ||
if r is None: | ||
break | ||
print(r) | ||
|
||
except asyncio.IncompleteReadError: | ||
pass | ||
except Exception as e: | ||
print(e) | ||
pass | ||
|
||
|
||
async def batch(pair): | ||
try: | ||
await asyncio.gather(subscriber(pair), publisher(pair)) | ||
except Exception as e: | ||
print(e) | ||
pass | ||
|
||
|
||
async def main(): | ||
tasks = [ asyncio.create_task(run_ipc_server("localhost", 3015))] | ||
for i in range(20): | ||
tasks.append(asyncio.create_task(batch(str(i)))) | ||
|
||
for t in tasks: | ||
await t | ||
|
||
|
||
asyncio.run(main()) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
from pydantic import Field | ||
from pydantic_settings import BaseSettings | ||
|
||
|
||
class AppSettings(BaseSettings): | ||
master_services_key_seed: str = Field('dummy') | ||
master_services_key_seed: str = Field("dummy") | ||
|
||
|
||
app_settings = AppSettings() | ||
app_settings = AppSettings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +0,0 @@ | ||
from . import messages | ||
from . import client | ||
from . import server | ||
Oops, something went wrong.