Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gjjh5
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data_server
gjjh5
Commits
fa54bb76
Commit
fa54bb76
authored
Mar 04, 2019
by
姜登
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nitify
parent
f2ca4b8e
Pipeline
#4005
passed with stage
in 50 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
18 deletions
+11
-18
notifyUrl.js
app/schedule/notifyUrl.js
+11
-18
No files found.
app/schedule/notifyUrl.js
View file @
fa54bb76
const
Subscription
=
require
(
'egg'
).
Subscription
;
'use strict'
;
class
UpdateCache
extends
Subscription
{
// 通过 schedule 属性来设置定时任务的执行间隔等配置
static
get
schedule
()
{
return
{
interval
:
'5m'
,
// 5分钟间隔
type
:
'all'
,
// 所有woker
immediate
:
true
,
};
}
module
.
exports
=
{
schedule
:
{
interval
:
'5m'
,
// 5分钟间隔
type
:
'all'
,
// 所有woker
immediate
:
true
,
},
// subscribe 是真正定时任务执行时被运行的函数
async
subscribe
()
{
async
task
(
ctx
)
{
try
{
const
{
ctx
}
=
this
;
const
{
host
,
customerUrl
}
=
ctx
.
app
.
config
.
signatureAPI
;
const
notifyMap
=
new
Map
();
const
ret
=
await
ctx
.
curl
(
host
+
customerUrl
,
{
...
...
@@ -32,9 +27,7 @@ class UpdateCache extends Subscription {
ctx
.
app
.
notifyMap
=
notifyMap
;
}
}
catch
(
e
)
{
this
.
ctx
.
logger
.
error
(
'【schedule/notifyUrlTask】catch error:'
,
JSON
.
stringify
(
e
));
ctx
.
logger
.
error
(
'【schedule/notifyUrlTask】catch error:'
,
JSON
.
stringify
(
e
));
}
}
}
module
.
exports
=
UpdateCache
;
\ No newline at end of file
}
\ No newline at end of file
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