Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
12942674
Commit
12942674
authored
Aug 25, 2016
by
Paul Morie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve godoc for goroutinemap
parent
b44b7169
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
goroutinemap.go
pkg/util/goroutinemap/goroutinemap.go
+9
-3
No files found.
pkg/util/goroutinemap/goroutinemap.go
View file @
12942674
...
...
@@ -43,7 +43,10 @@ const (
maxDurationBeforeRetry
=
2
*
time
.
Minute
)
// GoRoutineMap defines the supported set of operations.
// GoRoutineMap defines a type that can run named goroutines and track their
// state. It prevents the creation of multiple goroutines with the same name
// and may prevent recreation of a goroutine until after the a backoff time
// has elapsed after the last goroutine with that name finished.
type
GoRoutineMap
interface
{
// Run adds operation name to the list of running operations and spawns a
// new go routine to execute the operation.
...
...
@@ -59,8 +62,8 @@ type GoRoutineMap interface {
// and evaluate results after that.
Wait
()
// IsOperationPending returns true if the operation is pending
, otherwise
// r
eturns false
// IsOperationPending returns true if the operation is pending
(currently
// r
unning), otherwise returns false.
IsOperationPending
(
operationName
string
)
bool
}
...
...
@@ -82,6 +85,7 @@ type goRoutineMap struct {
lock
sync
.
RWMutex
}
// operation holds the state of a single goroutine.
type
operation
struct
{
operationPending
bool
expBackoff
exponentialbackoff
.
ExponentialBackoff
...
...
@@ -122,6 +126,8 @@ func (grm *goRoutineMap) Run(
return
nil
}
// operationComplete handles the completion of a goroutine run in the
// goRoutineMap.
func
(
grm
*
goRoutineMap
)
operationComplete
(
operationName
string
,
err
*
error
)
{
// Defer operations are executed in Last-In is First-Out order. In this case
...
...
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