@@ -20,23 +20,32 @@ func main() {
2020 panelServ := configuration .GetPanelServiceName ()
2121 client := utmconf .NewUTMClient (intKey , "http://" + panelServ )
2222
23- for {
23+ ticker := time .NewTicker (time .Second * delayCheck )
24+ defer ticker .Stop ()
25+
26+ startTime := time .Now ().Add (- 600 * time .Second ).UTC ()
27+
28+ for range ticker .C {
2429 if err := utils .ConnectionChecker (configuration .CHECKCON ); err != nil {
2530 utils .Logger .ErrorF ("External connection failure detected: %v" , err )
2631 }
2732
33+ endTime := startTime .Add (299 * time .Second ).UTC ()
34+ startTimeStr := startTime .Format (time .RFC3339 )
35+ endTimeStr := endTime .Format (time .RFC3339 )
36+
2837 moduleConfig , err := client .GetUTMConfig (enum .SOPHOS )
2938 if err != nil {
3039 if strings .Contains (err .Error (), "invalid character '<'" ) {
31- time . Sleep (time .Second * delayCheck )
40+ startTime = endTime . Add (time .Second )
3241 continue
3342 }
3443 if (err .Error () != "" ) && (err .Error () != " " ) {
3544 utils .Logger .ErrorF ("error getting configuration of the SOPHOS module: %v" , err )
3645 }
3746
3847 utils .Logger .Info ("sync complete waiting %v seconds" , delayCheck )
39- time . Sleep (time .Second * delayCheck )
48+ startTime = endTime . Add (time .Second )
4049 continue
4150 }
4251
@@ -56,7 +65,7 @@ func main() {
5665 }
5766
5867 if ! skip {
59- processor .PullLogs (group )
68+ processor .PullLogs (group , startTimeStr , endTimeStr )
6069 }
6170
6271 wg .Done ()
@@ -65,6 +74,7 @@ func main() {
6574
6675 wg .Wait ()
6776 utils .Logger .Info ("sync complete waiting %d seconds" , delayCheck )
68- time .Sleep (time .Second * delayCheck )
77+
78+ startTime = endTime .Add (time .Second )
6979 }
7080}
0 commit comments