Compare commits
No commits in common. "e21cd9ed11ec2adceb4517e55a545b5ef91433fd" and "613e21597b00f5bf44c6c05a92e0375021c5c641" have entirely different histories.
e21cd9ed11
...
613e21597b
4
cron.go
4
cron.go
@ -7,7 +7,6 @@ import "context"
|
||||
// tasks on time intervals.
|
||||
type cron struct {
|
||||
trimFunc func() bool
|
||||
fastTiming bool
|
||||
timing struct {
|
||||
trimInterval time.Duration
|
||||
}
|
||||
@ -29,9 +28,6 @@ func (this *cron) Configure (config Config) error {
|
||||
}
|
||||
this.timing.trimInterval = value
|
||||
}
|
||||
if this.fastTiming {
|
||||
this.timing.trimInterval = time.Second * 10
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -33,7 +33,6 @@ type environment struct {
|
||||
done context.CancelCauseFunc
|
||||
group sync.WaitGroup
|
||||
conf MutableConfig
|
||||
cron *cron
|
||||
|
||||
// flags stores information from built-in flags.
|
||||
flags struct {
|
||||
@ -44,7 +43,6 @@ type environment struct {
|
||||
verbose bool
|
||||
crash bool
|
||||
crashOnError bool
|
||||
fastTiming bool
|
||||
}
|
||||
|
||||
// running stores whether the environment is currently running.
|
||||
@ -82,11 +80,10 @@ func (this *environment) Run(name, description string, actors ...Actor) {
|
||||
this.name = name
|
||||
this.description = description
|
||||
this.actors = usync.NewRWMonitor(&actorSets { })
|
||||
this.cron = &cron {
|
||||
trimFunc: this.phase70_5Trimming,
|
||||
}
|
||||
this.addToSets(actors...)
|
||||
this.addToSets(this.cron)
|
||||
this.addToSets(&cron {
|
||||
trimFunc: this.phase70_5Trimming,
|
||||
})
|
||||
|
||||
if !this.phase10FlagParsing() { os.Exit(2) }
|
||||
if !this.phase13PidFileCreation() { os.Exit(1) }
|
||||
@ -421,7 +418,6 @@ func (this *environment) applyConfig() error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// TODO: trim interval
|
||||
err := parseDuration("init-timeout", &this.timing.initTimeout)
|
||||
if err != nil { return err }
|
||||
err = parseDuration("restart-threshold", &this.timing.restartThreshold)
|
||||
@ -438,11 +434,6 @@ func (this *environment) applyConfig() error {
|
||||
if err != nil { return err }
|
||||
err = parseDuration("shutdown-timeout", &this.timing.shutdownTimeout)
|
||||
if err != nil { return err }
|
||||
|
||||
if this.flags.fastTiming {
|
||||
this.timing.shutdownTimeout.Store(time.Second * 10)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
11
phases.go
11
phases.go
@ -24,10 +24,9 @@ func (this *environment) phase10FlagParsing() bool {
|
||||
flagUser := set.Flag('u', "user", "The user:group to run as", cli.ValString)
|
||||
flagLogDirectory := set.Flag('l', "log-directory", "Write logs to the specified directory", cli.ValString)
|
||||
flagConfigFile := set.Flag('c', "config-file", "Use this configuration file", cli.ValString)
|
||||
flagVerbose := set.Flag('v', "verbose", "(debug) Enable verbose output/logging", nil)
|
||||
flagCrash := set.Flag(0, "crash", "(debug) Crash when an actor panics", nil)
|
||||
flagCrashOnError := set.Flag(0, "crash-on-error", "(debug) Crash when an actor experiences any error", nil)
|
||||
flagFastTiming := set.Flag(0, "fast-timing", "(debug) Make timed things happen faster/more often", nil)
|
||||
flagVerbose := set.Flag('v', "verbose", "Enable verbose output/logging", nil)
|
||||
flagCrash := set.Flag(0, "crash", "Crash when an actor panics", nil)
|
||||
flagCrashOnError := set.Flag(0, "crash-on-error", "Crash when an actor experiences any error", nil)
|
||||
|
||||
// ask actors to add flags
|
||||
actors, done := this.actors.RBorrow()
|
||||
@ -71,10 +70,6 @@ func (this *environment) phase10FlagParsing() bool {
|
||||
this.flags.crash = true
|
||||
this.flags.crashOnError = true
|
||||
}
|
||||
if _, ok := flagFastTiming.First(); ok {
|
||||
this.flags.fastTiming = true
|
||||
this.cron.fastTiming = true
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user