correr a las 8 am
This commit is contained in:
parent
9456c5e37f
commit
0f6bd3c7e3
1 changed files with 4 additions and 2 deletions
6
main.go
6
main.go
|
@ -38,9 +38,11 @@ func main() {
|
||||||
cycle()
|
cycle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const timezoneOffset = -3
|
||||||
|
|
||||||
func cycle() {
|
func cycle() {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
lastWeek := now.Add(-time.Hour * 24 * time.Duration(now.Weekday()-time.Monday))
|
lastWeek := now.Add(-time.Hour*24*time.Duration(now.Weekday()-time.Monday) + 8 - timezoneOffset)
|
||||||
if now.Weekday() > time.Sunday {
|
if now.Weekday() > time.Sunday {
|
||||||
err := createIfNotExists(lastWeek.Format("semana 2006-01-02"))
|
err := createIfNotExists(lastWeek.Format("semana 2006-01-02"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -48,7 +50,7 @@ func cycle() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(time.Hour * 5)
|
time.Sleep(time.Minute * 10)
|
||||||
cycle()
|
cycle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue