Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only close the cache db if it is not null. #5631

Merged
merged 6 commits into from
Jan 9, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions modules/nextflow/src/main/groovy/nextflow/Session.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1209,10 +1209,8 @@ class Session implements ISession {
if( aborted || cancelled || error )
return

CacheDB db = null
try {
try (CacheDB db = CacheFactory.create(uniqueId, runName).openForRead()) {
log.trace "Cleaning-up workdir"
pditommaso marked this conversation as resolved.
Show resolved Hide resolved
db = CacheFactory.create(uniqueId, runName).openForRead()
db.eachRecord { HashCode hash, TraceRecord record ->
def deleted = db.removeTaskEntry(hash)
if( deleted ) {
Expand All @@ -1223,10 +1221,7 @@ class Session implements ISession {
log.trace "Clean workdir complete"
}
catch( Exception e ) {
log.warn("Failed to cleanup work dir: ${workDir.toUriString()}")
}
finally {
db.close()
log.warn("Failed to cleanup work dir: ${workDir.toUriString()}", e)
}
}

Expand Down
Loading