added the second attempt to send the card to the encoder after 6 seconds

This commit is contained in:
2026-04-20 11:17:27 +01:00
parent c6c2b40f37
commit 20fcbe5499
4 changed files with 24 additions and 9 deletions
+16 -4
View File
@@ -296,11 +296,17 @@ func (c *Client) DispenserStart(ctx context.Context) (string, error) {
return stockStatus, fmt.Errorf("[%s] to encoder: %w", funcName, err)
}
deadline := time.Now().Add(6 * time.Second)
halfway := time.Now().Add(6 * time.Second)
deadline := time.Now().Add(12 * time.Second)
for {
time.Sleep(delay * 2)
if time.Now().After(deadline) {
switch {
case time.Now().After(halfway):
if err := c.ToEncoder(ctx); err != nil {
return stockStatus, fmt.Errorf("[%s] to encoder: %w", funcName, err)
}
case time.Now().After(deadline):
return stockStatus, nil
}
@@ -345,11 +351,17 @@ func (c *Client) DispenserFinal(ctx context.Context) (string, error) {
logStatus(status)
}()
deadline := time.Now().Add(6 * time.Second)
halfway := time.Now().Add(6 * time.Second)
deadline := time.Now().Add(12 * time.Second)
for {
time.Sleep(delay * 2)
if time.Now().After(deadline) {
switch {
case time.Now().After(halfway):
if err := c.ToEncoder(ctx); err != nil {
return stockStatus, fmt.Errorf("[%s] to encoder: %w", funcName, err)
}
case time.Now().After(deadline):
return stockStatus, nil
}