Skip to content

Commit

Permalink
Merge branch 'master' into graphql
Browse files Browse the repository at this point in the history
  • Loading branch information
trim21 committed Sep 23, 2024
2 parents 9895178 + 2c4898c commit c43d3c6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 43 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ RUN pip install -U pip && \

WORKDIR /app

ENTRYPOINT [ "python", "./start_grpc_server.py" ]
ENTRYPOINT [ "python", "-m", "start_grpc_server" ]

COPY . ./
14 changes: 7 additions & 7 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ pymysql = "1.1.1"
pydantic = "2.9.2"
pydantic-settings = "2.5.2"
typing-extensions = '4.12.2'
sslog = "0.0.0a45"
sslog = "0.0.0a47"
protobuf = "5.27.2"
ariadne = "^0.23.0"
uvicorn = { version = "^0.30.6", extras = ['standard'] }
aiomysql = "^0.2.0"
six = "^1.16.0"
six = "1.16.0"

[tool.poetry.group.dev.dependencies]
sqlacodegen = "3.0.0rc5"
Expand Down
4 changes: 2 additions & 2 deletions rpc/timeline_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def __episode_collect(self, req: EpisodeCollectRequest) -> EpisodeCollectRespons
)

if tl and tl.created_at >= int(time.time() - 15 * 60):
logger.info("find previous timeline, updating")
logger.info("find previous timeline, updating", user_id=req.user_id)
if (
tl.cat == TimelineCat.Progress
and tl.type == tlType
Expand Down Expand Up @@ -263,7 +263,7 @@ def __subject_progress(
)

if tl and tl.created_at >= int(time.time() - 15 * 60):
logger.info("find previous timeline, updating")
logger.info("find previous timeline, updating", user_id=req.user_id)
if (
tl.cat == TimelineCat.Progress
and tl.type == tlType
Expand Down
37 changes: 6 additions & 31 deletions scripts/grpc_client.py
Original file line number Diff line number Diff line change
@@ -1,41 +1,16 @@
import grpc
from sslog import logger

from api.v1 import timeline_pb2_grpc
from api.v1.timeline_pb2 import (
Episode,
EpisodeCollectRequest,
EpisodeCollectResponse,
Subject,
)
from api.v1.timeline_pb2 import HelloRequest
from chii.config import config


def run() -> None:
print("Will try to greet world ...")
with grpc.insecure_channel("127.0.0.1:5000") as channel:
logger.info("healthy check")
with grpc.insecure_channel(f"127.0.0.1:{config.grpc_port}") as channel:
stub = timeline_pb2_grpc.TimeLineServiceStub(channel)
response: EpisodeCollectResponse = stub.EpisodeCollect(
EpisodeCollectRequest(
user_id=100,
last=Episode(
name_cn="22",
type=1,
name="name",
id=1,
sort=1.4,
),
subject=Subject(
id=88,
name="nn",
image="image image",
type=2,
name_cn="name cn",
series=False,
eps_total=0,
vols_total=0,
),
)
)
print("Greeter client received:", response.ok)
stub.Hello(HelloRequest(name="client"))


if __name__ == "__main__":
Expand Down

0 comments on commit c43d3c6

Please sign in to comment.