Improve expr types, add r/w locking

This commit is contained in:
Denis Arh
2021-07-14 10:49:32 +02:00
parent d63f21c941
commit a7e2eec9fd
15 changed files with 795 additions and 304 deletions
+4 -4
View File
@@ -185,7 +185,7 @@ func NewSession(ctx context.Context, g *Graph, oo ...SessionOpt) *Session {
return s
}
func (s Session) Status() SessionStatus {
func (s *Session) Status() SessionStatus {
s.mux.RLock()
defer s.mux.RUnlock()
@@ -207,14 +207,14 @@ func (s Session) Status() SessionStatus {
}
}
func (s Session) ID() uint64 {
func (s *Session) ID() uint64 {
s.mux.RLock()
defer s.mux.RUnlock()
return s.id
}
func (s Session) Idle() bool {
func (s *Session) Idle() bool {
return s.Status() != SessionActive
}
@@ -514,7 +514,7 @@ func (s *Session) Stop() {
s.qErr <- nil
}
func (s Session) Suspended() bool {
func (s *Session) Suspended() bool {
defer s.mux.RUnlock()
s.mux.RLock()
return len(s.delayed) > 0
+1 -1
View File
@@ -96,7 +96,7 @@ func TestSession_SplitAndMerge(t *testing.T) {
ctx = context.Background()
req = require.New(t)
wf = NewGraph()
ses = NewSession(ctx, wf)
ses = NewSession(ctx, wf, SetDumpStacktraceOnPanic(true))
start = &sesTestStep{name: "start"}
split1 = &sesTestStep{name: "split1"}