Skip to content

Commit 0e0448f

Browse files
authored
Merge pull request #107 from common-workflow-language/cache-updating
Fix cache updates
2 parents 288285a + 5a4921c commit 0e0448f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/main/java/org/commonwl/view/workflow/WorkflowService.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,16 @@ public Workflow getWorkflow(GithubDetails githubInfo) {
123123
if (workflow != null) {
124124
// Delete the existing workflow if the cache has expired
125125
if (cacheExpired(workflow)) {
126-
// Update by trying to add a new workflow
126+
removeWorkflow(workflow);
127+
128+
// Add the new workflow if it exists
127129
Workflow newWorkflow = createWorkflow(workflow.getRetrievedFrom());
128130

129-
// Only replace workflow if it could be successfully parsed
130131
if (newWorkflow == null) {
132+
// Add back the old workflow if it is broken now
131133
logger.error("Could not parse updated workflow " + workflow.getID());
134+
workflowRepository.save(workflow);
132135
} else {
133-
// Delete the existing workflow
134-
removeWorkflow(workflow);
135-
136-
// Save new workflow
137-
workflowRepository.save(newWorkflow);
138136
workflow = newWorkflow;
139137
}
140138
}

0 commit comments

Comments
 (0)