Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add starting delay when proc start #137

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/goreman
/goxz
*.exe

.idea
.git
.cover
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change requied?

3 changes: 3 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ var exitOnStop = flag.Bool("exit-on-stop", true, "Exit goreman if all subprocess
// show timestamp in log
var logTime = flag.Bool("logtime", true, "show timestamp in log")

// start proc interval (sec)
var interval = flag.Uint("interval", 0, "start proc interval (sec)")

var maxProcNameLength = 0

var re = regexp.MustCompile(`\$([a-zA-Z]+[a-zA-Z0-9_]+)`)
Expand Down
5 changes: 5 additions & 0 deletions proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@ func startProcs(sc <-chan os.Signal, rpcCh <-chan *rpcMessage, exitOnError bool)

for _, proc := range procs {
startProc(proc.name, &wg, errCh)
// sleep N sec. because sometimes, dependencies checking between stateful services (procs)
// will let it starting fail .
if *interval > 0 {
time.Sleep(time.Second * time.Duration(*interval))
}
}

allProcsDone := make(chan struct{}, 1)
Expand Down