Compare commits

...

4 Commits

Author SHA1 Message Date
4d5a4d44bd Merge pull request 'master' (#6) from master into prod
Reviewed-on: #6
2024-12-08 19:54:18 +03:00
06ca5f5f3c fix
All checks were successful
Deploy Dev / Build (pull_request) Successful in 9s
Deploy Dev / Push (pull_request) Successful in 18s
Deploy Dev / Deploy dev (pull_request) Successful in 8s
Deploy Prod / Build (pull_request) Successful in 8s
Deploy Prod / Push (pull_request) Successful in 14s
Deploy Prod / Deploy prod (pull_request) Successful in 9s
2024-12-08 19:34:56 +03:00
8ea015e277 fix 2024-12-08 15:37:02 +03:00
7c2fb7cd6e fix 2024-12-08 15:33:34 +03:00
4 changed files with 7 additions and 44 deletions

3
.gitignore vendored
View File

@ -118,4 +118,5 @@ GitHub.sublime-settings
!.vscode/extensions.json
.history
*pb2*
*pb2*
schemas

View File

@ -1,4 +1,6 @@
gen:
python -m grpc_tools.protoc --proto_path schemas --python_out=. --pyi_out=. --grpc_python_out=. ./schemas/tasks.proto
curl https://platform.sprinthub.ru/generator >> generator.py
python generator.py
rm generator.py
run:
python ./server.py

View File

@ -1,40 +0,0 @@
syntax = "proto3";
package queues;
import "google/protobuf/struct.proto";
service Tasks {
rpc Put (PutRequest) returns (EmptyResponse) {}
rpc Take (TakeRequest) returns (TakeResponse) {}
rpc Finish (FinishRequest) returns (EmptyResponse) {}
}
message Task {
string id = 1;
int64 attempt = 2;
google.protobuf.Struct payload = 3;
}
message PutRequest {
string queue = 1;
int64 seconds_to_execute = 2;
optional int64 delay = 3;
google.protobuf.Struct payload = 4;
}
message TakeRequest {
string queue = 1;
}
message FinishRequest {
string id = 1;
}
message EmptyResponse {}
message TakeResponse {
optional Task task = 1;
}

View File

@ -3,8 +3,8 @@ import datetime
import grpc
import bson
import tasks_pb2
import tasks_pb2_grpc
from queues import tasks_pb2
from queues import tasks_pb2_grpc
from utils import time
from storage.mongo import tasks