@@ -164,38 +164,6 @@ type instanceState struct {
164
164
LastSequenceID int64 `json:"last_sequence_id,omitempty"`
165
165
}
166
166
167
- func createInstanceP (ctx context.Context , p redis.Pipeliner , instance * core.WorkflowInstance , metadata * metadata.WorkflowMetadata ) error {
168
- key := instanceKey (instance )
169
-
170
- createdAt := time .Now ()
171
-
172
- b , err := json .Marshal (& instanceState {
173
- Instance : instance ,
174
- State : core .WorkflowInstanceStateActive ,
175
- Metadata : metadata ,
176
- CreatedAt : createdAt ,
177
- })
178
- if err != nil {
179
- return fmt .Errorf ("marshaling instance state: %w" , err )
180
- }
181
-
182
- p .SetNX (ctx , key , string (b ), 0 )
183
-
184
- // The newly created instance is going to be the active execution
185
- if err := setActiveInstanceExecutionP (ctx , p , instance ); err != nil {
186
- return fmt .Errorf ("setting active instance execution: %w" , err )
187
- }
188
-
189
- p .ZAdd (ctx , instancesByCreation (), redis.Z {
190
- Member : instanceSegment (instance ),
191
- Score : float64 (createdAt .UnixMilli ()),
192
- })
193
-
194
- p .SAdd (ctx , instancesActive (), instanceSegment (instance ))
195
-
196
- return nil
197
- }
198
-
199
167
func readInstance (ctx context.Context , rdb redis.UniversalClient , instanceKey string ) (* instanceState , error ) {
200
168
p := rdb .Pipeline ()
201
169
@@ -246,14 +214,3 @@ func readActiveInstanceExecution(ctx context.Context, rdb redis.UniversalClient,
246
214
247
215
return instance , nil
248
216
}
249
-
250
- func setActiveInstanceExecutionP (ctx context.Context , p redis.Pipeliner , instance * core.WorkflowInstance ) error {
251
- key := activeInstanceExecutionKey (instance .InstanceID )
252
-
253
- b , err := json .Marshal (instance )
254
- if err != nil {
255
- return fmt .Errorf ("marshaling instance: %w" , err )
256
- }
257
-
258
- return p .Set (ctx , key , string (b ), 0 ).Err ()
259
- }
0 commit comments