mirror of
https://github.com/logos-messaging/sds-go-bindings.git
synced 2026-01-02 14:13:08 +00:00
adding StartPeriodicTasks
This commit is contained in:
parent
45e4f122b2
commit
94fe0d4919
32
sds/sds.go
32
sds/sds.go
@ -120,6 +120,10 @@ package sds
|
||||
resp);
|
||||
}
|
||||
|
||||
static void cGoStartPeriodicTasks(void* rmCtx, void* resp) {
|
||||
StartPeriodicTasks(rmCtx, (SdsCallBack) GoCallback, resp);
|
||||
}
|
||||
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
@ -454,3 +458,31 @@ func (rm *ReliabilityManager) MarkDependenciesMet(messageIDs []MessageID) error
|
||||
|
||||
return errors.New(errMsg)
|
||||
}
|
||||
|
||||
func (rm *ReliabilityManager) StartPeriodicTasks() error {
|
||||
if rm == nil {
|
||||
err := errors.New("reliability manager is nil")
|
||||
Error("Failed to start periodic tasks %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
Debug("Starting periodic tasks")
|
||||
|
||||
wg := sync.WaitGroup{}
|
||||
var resp = C.allocResp(unsafe.Pointer(&wg))
|
||||
defer C.freeResp(resp)
|
||||
|
||||
wg.Add(1)
|
||||
C.cGoStartPeriodicTasks(rm.rmCtx, resp)
|
||||
wg.Wait()
|
||||
|
||||
if C.getRet(resp) == C.RET_OK {
|
||||
Debug("Successfully started periodic tasks")
|
||||
return nil
|
||||
}
|
||||
|
||||
errMsg := "error StartPeriodicTasks: " + C.GoStringN(C.getMyCharPtr(resp), C.int(C.getMyCharLen(resp)))
|
||||
Error("Failed to start periodic tasks: %v", errMsg)
|
||||
|
||||
return errors.New(errMsg)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user