periodic/periodic.go
func Every(interval time.Duration, procfunc gp.ProcessFunc) gp.Process {
	return gp.Go(func(proc gp.Process) {
		for {
			select {
			case <-time.After(interval):
				select {
				case <-proc.Go(procfunc).Closed(): // spin it out as a child, and wait till it's done.
				case <-proc.Closing(): // we're told to close
					return
				}
			case <-proc.Closing(): // we're told to close
				return
			}
		}
	})
}
func Every(interval time.Duration, procfunc gp.ProcessFunc) gp.Process {
	return gp.Go(func(proc gp.Process) {
		for {
			select {
			case <-time.After(interval):
				select {
				case <-proc.Go(procfunc).Closed(): // spin it out as a child, and wait till it's done.
				case <-proc.Closing(): // we're told to close
					return
				}
			case <-proc.Closing(): // we're told to close
				return
			}
		}
	})
}
func Every ( interval time . Duration , procfunc gp . ProcessFunc ) gp . Process { return gp . Go ( func ( proc gp . Process ) { for { select { case <- time . After ( interval ) : select { case <- proc . Go ( procfunc ) . Closed ( ) : // spin it out as a child, and wait till it's done. case <- proc . Closing ( ) : // we're told to close return } case <- proc . Closing ( ) : // we're told to close return } } } ) }
// Every calls the given ProcessFunc at periodic intervals. Internally, it uses
// <-time.After(interval), so it will have the behavior of waiting _at least_
// interval in between calls. If you'd prefer the time.Ticker behavior, use
// periodicproc.Tick instead.
// This is sequentially rate limited, only one call will be in-flight at a time.
Every calls the given ProcessFunc at periodic intervals . Internally it uses < - time . After ( interval ) so it will have the behavior of waiting _at least_ interval in between calls . If you d prefer the time . Ticker behavior use periodicproc . Tick instead . This is sequentially rate limited only one call will be in - flight at a time .