Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
ai-api-mgr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
ai-api-mgr
Commits
19b8e4e1
Commit
19b8e4e1
authored
Feb 21, 2024
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update field
parent
1b3fb251
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
callback.go
callback.go
+1
-1
main.go
main.go
+12
-12
No files found.
callback.go
View file @
19b8e4e1
...
...
@@ -30,7 +30,7 @@ func req(uuid string) chan pbUpstream.TaskResponse {
func
res
(
res
pbUpstream
.
TaskResponse
)
{
if
v
,
ok
:=
recordmap
.
LoadAndDelete
(
res
.
Task
Uui
d
);
ok
{
if
v
,
ok
:=
recordmap
.
LoadAndDelete
(
res
.
Task
I
d
);
ok
{
resAsV
,
ok
:=
v
.
(
chan
pbUpstream
.
TaskResponse
)
if
ok
{
resAsV
<-
res
...
...
main.go
View file @
19b8e4e1
...
...
@@ -60,7 +60,7 @@ type bytesAndHeader struct {
var
producerMessagesBytes
=
make
(
chan
bytesAndHeader
,
1000
)
//var Task
UUID
Instream = make(chan string, 1000)
//var Task
Id
Instream = make(chan string, 1000)
// Channel to send messages from the Kafka consumer to the /consumer endpoint
var
consumerMessages
=
make
(
chan
string
)
...
...
@@ -157,7 +157,7 @@ func kafkaConsumerBytes(done chan interface{}, req, resTopic string) (chan pbUps
continue
}
fmt
.
Println
(
"reqConsumer msg"
,
pbMsg
.
Task
Uui
d
)
fmt
.
Println
(
"reqConsumer msg"
,
pbMsg
.
Task
I
d
)
select
{
case
<-
done
:
...
...
@@ -183,7 +183,7 @@ func kafkaConsumerBytes(done chan interface{}, req, resTopic string) (chan pbUps
continue
}
fmt
.
Println
(
"resConsumer msg"
,
pbMsg
.
Task
Uui
d
,
"len(resOutStream)"
,
len
(
resOutStream
))
fmt
.
Println
(
"resConsumer msg"
,
pbMsg
.
Task
I
d
,
"len(resOutStream)"
,
len
(
resOutStream
))
select
{
case
<-
done
:
...
...
@@ -229,7 +229,7 @@ func batchToQuestDb(done chan interface{}, reqStream chan pbUpstream.TaskContent
Symbol
(
"profit_acc"
,
task
.
TaskProfitAccount
)
.
Symbol
(
"worker_acc"
,
task
.
TaskWorkerAccount
)
.
Symbol
(
"result"
,
task
.
TaskResult
)
.
StringColumn
(
"id"
,
task
.
Task
Uui
d
)
.
StringColumn
(
"id"
,
task
.
Task
I
d
)
.
TimestampColumn
(
"time"
,
time
.
Unix
(
seconds
,
nanoseconds
%
1e9
))
.
Int64Column
(
"fee"
,
task
.
TaskFee
)
.
Int64Column
(
"workload"
,
int64
(
task
.
TaskWorkload
))
.
...
...
@@ -274,7 +274,7 @@ func batchToQuestDb(done chan interface{}, reqStream chan pbUpstream.TaskContent
Table
(
reqTableName
)
.
Symbol
(
"type"
,
fmt
.
Sprintf
(
"%d"
,
task
.
TaskType
))
.
Symbol
(
"uid"
,
task
.
TaskUid
)
.
StringColumn
(
"id"
,
task
.
Task
Uui
d
)
.
StringColumn
(
"id"
,
task
.
Task
I
d
)
.
TimestampColumn
(
"time"
,
time
.
Unix
(
seconds
,
nanoseconds
%
1e9
))
.
Int64Column
(
"fee"
,
int64
(
taskFeeAsInt
))
.
Int64Column
(
"in_len"
,
int64
(
task
.
TaskInLen
))
.
...
...
@@ -294,7 +294,7 @@ func batchToQuestDb(done chan interface{}, reqStream chan pbUpstream.TaskContent
}
type
ResponseJson
struct
{
Task
UUID
string
Task
Id
string
TaskResult
[]
byte
TaskUid
string
TaskFee
string
...
...
@@ -548,9 +548,9 @@ func ApiAndJWT(c *fiber.Ctx) error {
cmd
=
task
.
Cmd
pbMsg
:=
pbUpstream
.
TaskContent
{
Task
Uuid
:
reqHeaders
[
"Task-Id"
][
0
],
Task
Id
:
uint64
(
task
.
ID
),
Task
Type
:
1
,
Task
Id
:
reqHeaders
[
"Task-Id"
][
0
],
Task
Type
:
uint64
(
task
.
ID
),
Task
Kind
:
1
,
TaskCmd
:
cmd
,
TaskParam
:
c
.
Body
(),
//[]byte(reqHeaders["Task-Id"][0]),
TaskTimestamp
:
uint64
(
time
.
Now
()
.
UnixNano
()),
...
...
@@ -582,9 +582,9 @@ func ApiAndJWT(c *fiber.Ctx) error {
Bytes
:
pbBytes
,
}
fmt
.
Println
(
"pbMsg.TaskUid--------------"
,
pbMsg
.
Task
Uui
d
)
fmt
.
Println
(
"pbMsg.TaskUid--------------"
,
pbMsg
.
Task
I
d
)
wait
:=
req
(
pbMsg
.
Task
Uui
d
)
wait
:=
req
(
pbMsg
.
Task
I
d
)
resAsPb
:=
<-
wait
fmt
.
Println
(
"resAsPb.TaskResultHeader"
,
string
(
resAsPb
.
TaskResultHeader
),
len
(
resAsPb
.
TaskResultHeader
))
...
...
@@ -617,7 +617,7 @@ func ApiAndJWT(c *fiber.Ctx) error {
}
// resAsJson := ResponseJson{
// Task
UUID: resAsPb.TaskUui
d,
// Task
Id: resAsPb.TaskI
d,
// TaskResult: resAsPb.GetTaskResultBody(),
// TaskUid: resAsPb.TaskUid,
// TaskFee: resAsPb.TaskFee,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment