Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
c023532c
Commit
c023532c
authored
Sep 11, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
fd33be43
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
+11
-1
taskexecutor/app/base/db/task.base.js
+4
-1
taskexecutor/app/base/db/task/monitor/monitorTask.js
+7
-0
No files found.
taskexecutor/app/base/db/task.base.js
View file @
c023532c
...
...
@@ -28,9 +28,12 @@ class TaskBase {
//任务打点
//key taskuptime
let
taskName
=
this
.
formatedTaskName
(
this
.
serviceName
)
console
.
log
(
taskName
,
"vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv"
)
if
(
taskName
&&
taskName
.
trim
()
!=
""
)
{
let
nowtime
=
Date
.
now
()
this
.
redisClient
.
hmset
(
"taskuptime"
,
{
taskName
:
nowtime
})
let
tp
=
{}
tp
[
taskName
]
=
nowtime
this
.
redisClient
.
hmset
(
"taskuptime"
,
tp
)
}
//订阅任务频道
await
this
.
redisClient
.
subscribe
(
this
.
TASK_CHANNEL
);
...
...
taskexecutor/app/base/db/task/monitor/monitorTask.js
View file @
c023532c
...
...
@@ -12,12 +12,14 @@ class MonitorTask extends TaskBase {
* @param {*} taskName
*/
formatedTaskName
(
taskName
)
{
console
.
log
(
"formatedTaskName"
,
"ddddddddddddddddddd"
)
return
taskName
+
"|i|10"
}
isFail
(
taskName
,
lastAccess
)
{
let
n
=
Date
.
now
()
let
postMinute
=
(
n
-
lastAccess
)
/
1000
/
60
let
tnameparams
=
taskName
.
split
(
"|"
)
if
(
tnameparams
.
length
==
3
)
{
let
tname
=
tnameparams
[
0
].
trim
()
let
mtype
=
tnameparams
[
1
].
trim
()
let
pvalue
=
Number
(
tnameparams
[
2
].
trim
())
...
...
@@ -38,6 +40,11 @@ class MonitorTask extends TaskBase {
this
.
sendDing
(
tname
+
"可能失联啦...请检查"
)
}
}
}
else
{
this
.
sendDing
(
taskName
+
":任务名不符合监控格式"
)
}
}
async
subBeforeTask
(
params
)
{
console
.
log
(
"前置操作......"
,
this
.
serviceName
);
...
...
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