You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
728 B
Go
45 lines
728 B
Go
2 months ago
|
package icsbatch
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
stt "mybatch/icsstt"
|
||
|
|
||
|
"github.com/robfig/cron/v3"
|
||
|
)
|
||
|
|
||
|
func BatchForPostRequestForDataList() {
|
||
|
cronInstance := cron.New()
|
||
|
|
||
|
_, err := cronInstance.AddFunc("0 1 * * *", func() {
|
||
|
fmt.Println("매일 새벽 1시: ProcessPostRequestForDataList 실행")
|
||
|
stt.ProcessPostRequestForDataList()
|
||
|
})
|
||
|
|
||
|
if err != nil {
|
||
|
fmt.Println("스케줄 추가 오류:", err)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
cronInstance.Start()
|
||
|
|
||
|
select {}
|
||
|
}
|
||
|
|
||
|
func BatchForPostRequestForDataListTest() {
|
||
|
cronInstance := cron.New()
|
||
|
|
||
|
_, err := cronInstance.AddFunc("@every 20s", func() {
|
||
|
stt.ProcessPostRequestForDataList()
|
||
|
})
|
||
|
|
||
|
if err != nil {
|
||
|
fmt.Println("스케줄 추가 오류:", err)
|
||
|
return
|
||
|
}
|
||
|
|
||
|
cronInstance.Start()
|
||
|
|
||
|
select {}
|
||
|
|
||
|
}
|