luky116 commented on code in PR #745:
URL:
https://github.com/apache/incubator-seata-go/pull/745#discussion_r1894589397
##########
pkg/rm/tcc/fence/handler/tcc_fence_wrapper_handler.go:
##########
@@ -163,6 +165,40 @@ func (handler *tccFenceWrapperHandler)
InitLogCleanChannel() {
})
}
+func (handler *tccFenceWrapperHandler) InitLogCleanTask(tx *sql.Tx) {
+ handler.logTaskOnce.Do(func() {
+ // Create a ticker that will fire initially based on the time
remaining until the next midnight (00:00:00).
+ go func() {
+ ticker := time.NewTicker(getDurationUntilNextZero())
+ defer ticker.Stop()
+
+ for {
+ select {
+ case <-ticker.C:
+ now := time.Now()
+ // Get the start time of the day before
the current day (00:00:00) and assign it to timeBefore with the same location
as now.
+ timeBefore := time.Date(now.Year(),
now.Month(), now.Day()-1, 0, 0, 0, 0, now.Location())
+
+ for {
+ deletedRowCount, err :=
handler.tccFenceDao.DeleteTCCFenceDOByMdfDate(tx, timeBefore, limitDelete)
+ if err != nil {
+ fmt.Printf("Error
occurred during TCC fence clean task: %v\n", err)
Review Comment:
日志统一使用 log 来输出
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]