Commit d108ab31 authored by Bas Lijnse's avatar Bas Lijnse

Fixed removal of task instance data if persistTask option is switched off

parent 3186e4c4
......@@ -193,8 +193,15 @@ replaceTaskInstance instanceNo task iworld=:{options={appVersion},current={taskT
`b` \iworld -> (Ok (), iworld)
deleteTaskInstance :: !InstanceNo !*IWorld -> *(!MaybeError TaskException (), !*IWorld)
deleteTaskInstance instanceNo iworld
//Delete all states
deleteTaskInstance instanceNo iworld=:{IWorld|options={EngineOptions|persistTasks}}
//Delete in administration
# (mbe,iworld) = 'SDS'.modify (\is -> ((),[i \\ i=:(no,_,_,_) <- is | no <> instanceNo])) (sdsFocus defaultValue filteredInstanceIndex) iworld
| mbe =: (Error _) = (mbe,iworld)
# (mbe,iworld) = 'SDS'.modify (\(Queue f r) -> ((),Queue [e \\ e=:(no,_) <- f | no <> instanceNo] [e \\ e=:(no,_) <- r | no <> instanceNo])) taskEvents iworld
| mbe =: (Error _) = (mbe,iworld)
| not persistTasks
= (Ok (),iworld)
//Delete all states on disk
# (mbe,iworld) = deleteValue NS_TASK_INSTANCES (instanceNo +++> "-reduct") iworld
| mbe =: (Error _) = (Error (exception (fromError mbe)),iworld)
# (mbe,iworld) = deleteValue NS_TASK_INSTANCES (instanceNo +++> "-value") iworld
......@@ -203,10 +210,6 @@ deleteTaskInstance instanceNo iworld
| mbe =: (Error _) = (Error (exception (fromError mbe)),iworld)
# (mbe,iworld) = deleteValue NS_TASK_INSTANCES (instanceNo +++> "-tasklists") iworld
| mbe =: (Error _) = (Error (exception (fromError mbe)),iworld)
# (mbe,iworld) = 'SDS'.modify (\is -> ((),[i \\ i=:(no,_,_,_) <- is | no <> instanceNo])) (sdsFocus defaultValue filteredInstanceIndex) iworld
| mbe =: (Error _) = (mbe,iworld)
# (mbe,iworld) = 'SDS'.modify (\(Queue f r) -> ((),Queue [e \\ e=:(no,_) <- f | no <> instanceNo] [e \\ e=:(no,_) <- r | no <> instanceNo])) taskEvents iworld
| mbe =: (Error _) = (mbe,iworld)
= (Ok (),iworld)
//Filtered interface to the instance index. This interface should always be used to access instance data
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment