wip
This commit is contained in:
parent
c3e00455c9
commit
c3dfe194bd
|
@ -19,22 +19,22 @@ func NewRecur(repoRecur Recurrer, repoSync Syncer, interval time.Duration, logge
|
|||
repoSync: repoSync,
|
||||
logger: logger,
|
||||
}
|
||||
go r.run(interval)
|
||||
go r.Run(interval)
|
||||
|
||||
return r
|
||||
}
|
||||
|
||||
func (r *Recur) run(interval time.Duration) {
|
||||
func (r *Recur) Run(interval time.Duration) {
|
||||
ticker := time.NewTicker(interval)
|
||||
|
||||
for range ticker.C {
|
||||
if err := r.recur(); err != nil {
|
||||
if err := r.Recur(); err != nil {
|
||||
r.logger.Error("could not recur", "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Recur) recur() error {
|
||||
func (r *Recur) Recur() error {
|
||||
items, err := r.repoRecur.RecursBefore(time.Now())
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -45,7 +45,8 @@ func (r *Recur) recur() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ne.Start = i.RecurNext // TODO something with time
|
||||
y, m, d := i.RecurNext.Date()
|
||||
ne.Start = time.Date(y, m, d, ne.Start.Hour(), ne.Start.Minute(), 0, 0, time.UTC)
|
||||
ni, err := ne.Item()
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
package main_test
|
Loading…
Reference in New Issue