Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ func (wflow *API) GetState() []string {
strs = append(strs, fmt.Sprintln("Temporal Connection Attempted: ", wt.State.ConnectionAttempted.Load()))
strs = append(strs, fmt.Sprintln("Temporal Connection Succeeded: ", wt.State.ConnectionSucc.Load()))
strs = append(strs, fmt.Sprintln("Temporal Status: ", computils.CompStatus(wt.State.HealthStatus.Load()).String()))
strs = append(strs, fmt.Sprintln("Temporal Last Error: ", *wt.State.Err))
strs = append(strs, fmt.Sprintln("Temporal Connection Time: ", wt.State.ConnectionTime))
errMsg, _ := wt.State.Err.Load().(string)
connectionTime, _ := wt.State.ConnectionTime.Load().(string)
strs = append(strs, fmt.Sprintln("Temporal Last Error: ", errMsg))
strs = append(strs, fmt.Sprintln("Temporal Connection Time: ", connectionTime))

return strs
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import (
"os"
"time"

"sync/atomic"
"unsafe"

"github.com/rs/zerolog"
zlogadapter "logur.dev/adapter/zerolog"
"logur.dev/logur"
Expand Down Expand Up @@ -48,14 +45,14 @@ func Orchestrator() {

// keep track how many events we've seen.
state.ConnectionAttempted.Inc()
state.ConnectionTime = time.Now().String()
state.ConnectionTime.Store(time.Now().String())

err := workflowOrchestrator()
if err != nil {
state.HealthStatus.Store(uint64(computils.CompUnhealthy))
tStr := err.Error()
atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&state.Err)), unsafe.Pointer(&tStr))
log.Error().Msg(*state.Err)
state.Err.Store(tStr)
log.Error().Msg(tStr)
} else {
// keep track how many succeeded.
state.ConnectionSucc.Inc()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package workflowtypes

import (
stdatomic "sync/atomic"

"go.temporal.io/sdk/client"
"go.temporal.io/sdk/worker"
"go.uber.org/atomic"
Expand All @@ -18,9 +20,9 @@ type State struct {
// HealthStatus current health state
HealthStatus atomic.Uint64
// Err is error message
Err *string
Err stdatomic.Value
// ConnectionTime time when attempted to connect
ConnectionTime string
ConnectionTime stdatomic.Value
}

// MgrState - Mgr state
Expand Down