Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
03eb1fc1
Commit
03eb1fc1
authored
Aug 21, 2014
by
astaxie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
toolbox: add notify when add & delete task
parent
0a967875
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
0 deletions
+11
-0
task.go
toolbox/task.go
+11
-0
No files found.
toolbox/task.go
View file @
03eb1fc1
...
@@ -33,6 +33,7 @@ type bounds struct {
...
@@ -33,6 +33,7 @@ type bounds struct {
var
(
var
(
AdminTaskList
map
[
string
]
Tasker
AdminTaskList
map
[
string
]
Tasker
stop
chan
bool
stop
chan
bool
changed
chan
bool
seconds
=
bounds
{
0
,
59
,
nil
}
seconds
=
bounds
{
0
,
59
,
nil
}
minutes
=
bounds
{
0
,
59
,
nil
}
minutes
=
bounds
{
0
,
59
,
nil
}
hours
=
bounds
{
0
,
23
,
nil
}
hours
=
bounds
{
0
,
23
,
nil
}
...
@@ -411,6 +412,8 @@ func run() {
...
@@ -411,6 +412,8 @@ func run() {
e
.
SetNext
(
effective
)
e
.
SetNext
(
effective
)
}
}
continue
continue
case
<-
changed
:
continue
case
<-
stop
:
case
<-
stop
:
return
return
}
}
...
@@ -425,6 +428,13 @@ func StopTask() {
...
@@ -425,6 +428,13 @@ func StopTask() {
// add task with name
// add task with name
func
AddTask
(
taskname
string
,
t
Tasker
)
{
func
AddTask
(
taskname
string
,
t
Tasker
)
{
AdminTaskList
[
taskname
]
=
t
AdminTaskList
[
taskname
]
=
t
changed
<-
true
}
// add task with name
func
DeleteTask
(
taskname
string
)
{
delete
(
AdminTaskList
,
taskname
)
changed
<-
true
}
}
// sort map for tasker
// sort map for tasker
...
@@ -578,4 +588,5 @@ func all(r bounds) uint64 {
...
@@ -578,4 +588,5 @@ func all(r bounds) uint64 {
func
init
()
{
func
init
()
{
AdminTaskList
=
make
(
map
[
string
]
Tasker
)
AdminTaskList
=
make
(
map
[
string
]
Tasker
)
stop
=
make
(
chan
bool
)
stop
=
make
(
chan
bool
)
changed
=
make
(
chan
bool
)
}
}
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