2024-02-16 21:31:00 +00:00
|
|
|
package temporal
|
2024-02-16 12:07:29 +00:00
|
|
|
|
|
|
|
import (
|
2024-02-16 13:50:35 +00:00
|
|
|
"time"
|
|
|
|
|
2024-02-16 12:07:29 +00:00
|
|
|
"code.tjo.space/mentos1386/zdravko/internal/config"
|
2024-02-16 13:50:35 +00:00
|
|
|
"code.tjo.space/mentos1386/zdravko/pkg/retry"
|
2024-02-16 12:07:29 +00:00
|
|
|
"go.temporal.io/sdk/client"
|
|
|
|
)
|
|
|
|
|
|
|
|
func ConnectToTemporal(cfg *config.Config) (client.Client, error) {
|
2024-02-16 13:50:35 +00:00
|
|
|
// Try to connect to the Temporal Server
|
|
|
|
return retry.Retry(5, 6*time.Second, func() (client.Client, error) {
|
|
|
|
return client.Dial(client.Options{
|
|
|
|
HostPort: cfg.Temporal.ServerHost,
|
|
|
|
})
|
|
|
|
})
|
2024-02-16 12:07:29 +00:00
|
|
|
}
|