Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
power-node
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
power-node
Commits
7cd93bc3
Commit
7cd93bc3
authored
Mar 22, 2024
by
duanjinfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handler container resp is nil
parent
dba82059
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
9 deletions
+23
-9
start.go
nm/start.go
+1
-0
task_msg.go
nm/task_msg.go
+22
-9
No files found.
nm/start.go
View file @
7cd93bc3
...
@@ -317,6 +317,7 @@ func handlerMsg(nodeManager *models.NodeManagerClient,
...
@@ -317,6 +317,7 @@ func handlerMsg(nodeManager *models.NodeManagerClient,
taskExecRes
.
TaskExecError
=
fmt
.
Sprintf
(
"%s-%s"
,
"Container sign failed"
,
taskExecRes
.
TaskExecError
)
taskExecRes
.
TaskExecError
=
fmt
.
Sprintf
(
"%s-%s"
,
"Container sign failed"
,
taskExecRes
.
TaskExecError
)
}
}
}
else
{
}
else
{
isSuccess
=
false
taskExecRes
.
TaskExecError
=
fmt
.
Sprintf
(
"%s-%s"
,
"Task exec error"
,
taskExecRes
.
TaskExecError
)
taskExecRes
.
TaskExecError
=
fmt
.
Sprintf
(
"%s-%s"
,
"Task exec error"
,
taskExecRes
.
TaskExecError
)
}
}
reqHash
,
respHash
,
minerSign
:=
taskMsgWorker
.
GetMinerSign
(
taskMsg
,
taskExecRes
.
TaskRespBody
)
reqHash
,
respHash
,
minerSign
:=
taskMsgWorker
.
GetMinerSign
(
taskMsg
,
taskExecRes
.
TaskRespBody
)
...
...
nm/task_msg.go
View file @
7cd93bc3
...
@@ -104,9 +104,7 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
...
@@ -104,9 +104,7 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
TaskExecTime
:
0
,
TaskExecTime
:
0
,
TaskExecError
:
""
,
TaskExecError
:
""
,
}
}
t
.
Mutex
.
Lock
()
t
.
LruCache
.
Add
(
taskMsg
.
TaskId
,
taskExecResult
)
t
.
LruCache
.
Add
(
taskMsg
.
TaskId
,
taskExecResult
)
t
.
Mutex
.
Unlock
()
taskCmd
:=
&
models
.
TaskCmd
{}
taskCmd
:=
&
models
.
TaskCmd
{}
err
:=
json
.
Unmarshal
(
bytes
.
NewBufferString
(
taskMsg
.
TaskCmd
)
.
Bytes
(),
taskCmd
)
err
:=
json
.
Unmarshal
(
bytes
.
NewBufferString
(
taskMsg
.
TaskCmd
)
.
Bytes
(),
taskCmd
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -295,6 +293,12 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
...
@@ -295,6 +293,12 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
apiResBody
:=
utils
.
EncodeJsonEscapeHTML
(
apiRes
)
apiResBody
:=
utils
.
EncodeJsonEscapeHTML
(
apiRes
)
taskExecResult
.
TaskRespBody
=
apiResBody
taskExecResult
.
TaskRespBody
=
apiResBody
}
}
if
len
(
apiRes
)
==
0
||
len
(
apiRes
[
0
])
==
0
{
log
.
Warn
(
"Container resp output is nil"
)
taskExecResult
.
TaskExecError
=
fmt
.
Sprintf
(
"worker:%s,%s"
,
conf
.
GetConfig
()
.
SignPublicAddress
.
Hex
(),
"Container resp output is nil"
)
t
.
ExecTaskIdIsSuccess
.
Store
(
taskMsg
.
TaskId
,
true
)
return
}
}
}
case
[]
string
:
case
[]
string
:
{
{
...
@@ -330,6 +334,12 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
...
@@ -330,6 +334,12 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
apiResBody
:=
utils
.
EncodeJsonEscapeHTML
(
apiRes
)
apiResBody
:=
utils
.
EncodeJsonEscapeHTML
(
apiRes
)
taskExecResult
.
TaskRespBody
=
apiResBody
taskExecResult
.
TaskRespBody
=
apiResBody
}
}
if
len
(
apiRes
)
==
0
{
log
.
Warn
(
"Container resp output is nil"
)
taskExecResult
.
TaskExecError
=
fmt
.
Sprintf
(
"worker:%s,%s"
,
conf
.
GetConfig
()
.
SignPublicAddress
.
Hex
(),
"Container resp output is nil"
)
t
.
ExecTaskIdIsSuccess
.
Store
(
taskMsg
.
TaskId
,
true
)
return
}
}
}
case
string
:
case
string
:
{
{
...
@@ -366,20 +376,23 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
...
@@ -366,20 +376,23 @@ func (t *TaskHandler) ComputeTaskHandler(taskMsg *nodeManagerV1.PushTaskMessage)
apiResBody
:=
utils
.
EncodeJsonEscapeHTML
(
apiRes
)
apiResBody
:=
utils
.
EncodeJsonEscapeHTML
(
apiRes
)
taskExecResult
.
TaskRespBody
=
apiResBody
taskExecResult
.
TaskRespBody
=
apiResBody
}
}
if
len
(
apiRes
)
==
0
{
log
.
Warn
(
"Container resp output is nil"
)
taskExecResult
.
TaskExecError
=
fmt
.
Sprintf
(
"worker:%s,%s"
,
conf
.
GetConfig
()
.
SignPublicAddress
.
Hex
(),
"Container resp output is nil"
)
t
.
ExecTaskIdIsSuccess
.
Store
(
taskMsg
.
TaskId
,
true
)
return
}
}
}
default
:
default
:
log
.
Error
(
"data is unknown type"
,
v
)
log
.
Error
(
"data is unknown type"
,
v
)
taskExecResult
.
TaskExecError
=
fmt
.
Sprintf
(
"worker:%s,%s"
,
conf
.
GetConfig
()
.
SignPublicAddress
.
Hex
(),
"Container resp data is unknown type"
)
taskExecResult
.
TaskExecError
=
fmt
.
Sprintf
(
"worker:%s,%s"
,
conf
.
GetConfig
()
.
SignPublicAddress
.
Hex
(),
"Container resp data is unknown type"
)
apiRes
:=
make
([]
string
,
0
)
t
.
ExecTaskIdIsSuccess
.
Store
(
taskMsg
.
TaskId
,
true
)
apiResBody
:=
utils
.
EncodeJsonEscapeHTML
(
apiRes
)
return
taskExecResult
.
TaskRespBody
=
apiResBody
}
}
}
else
{
}
else
{
taskExecResult
.
TaskExecError
=
fmt
.
Sprintf
(
"worker:%s,%s"
,
conf
.
GetConfig
()
.
SignPublicAddress
.
Hex
(),
"Container resp ouput is nil"
)
log
.
Error
(
"Container resp output is nil"
)
taskExecResult
.
TaskExecError
=
fmt
.
Sprintf
(
"worker:%s,%s"
,
conf
.
GetConfig
()
.
SignPublicAddress
.
Hex
(),
"Container resp output is nil"
)
t
.
ExecTaskIdIsSuccess
.
Store
(
taskMsg
.
TaskId
,
true
)
t
.
ExecTaskIdIsSuccess
.
Store
(
taskMsg
.
TaskId
,
true
)
apiRes
:=
make
([]
string
,
0
)
apiResBody
:=
utils
.
EncodeJsonEscapeHTML
(
apiRes
)
taskExecResult
.
TaskRespBody
=
apiResBody
return
return
}
}
}
}
...
...
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