feat(hardlink): unify kiosk payments and finalize legacy cleanup
This commit is contained in:
@@ -2,7 +2,6 @@ package creditcall
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"html"
|
||||
@@ -243,36 +242,3 @@ func ReadPdqStatus(hotel string, kiosk int) (PaymentDeviceStatus, error) {
|
||||
|
||||
return dev, nil
|
||||
}
|
||||
|
||||
func StartPdqHourlyCheck(ctx context.Context, hotel string, kiosk int) {
|
||||
// waitUntilNextHour(ctx)
|
||||
|
||||
// First execution exactly at round hour
|
||||
_, _ = ReadPdqStatus(hotel, kiosk)
|
||||
|
||||
ticker := time.NewTicker(10 * time.Second)
|
||||
defer ticker.Stop()
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-ticker.C:
|
||||
_, _ = ReadPdqStatus(hotel, kiosk)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func waitUntilNextHour(ctx context.Context) {
|
||||
now := time.Now()
|
||||
next := now.Truncate(time.Hour).Add(time.Hour)
|
||||
d := time.Until(next)
|
||||
|
||||
timer := time.NewTimer(d)
|
||||
defer timer.Stop()
|
||||
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
case <-timer.C:
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user