Workspace cleaner job param in wrong units (ms vs s) and wrong logic

Steps to reproduce

etc/config.properties contains:

  1. The maximum age a file must reach in seconds before a deletion of the file in the workspace cleanup operation is performed
    org.opencastproject.workspace.cleanup.max.age=2592000

but in modules/matterhorn-workspace-impl/src/main/java/org/opencastproject/workspace/impl/WorkspaceImpl.java

we have this comparison:

maxAgeReached = FileUtils.isFileOlder(file, new Date().getTime() + maxAge.get());

java.util.Date.getTime() is milliseconds. So maxAge is being interpreted as a ms value which means that instead of the default value being equal to 30 days, it is actually 43min.

Plus the logic of this looks wrong - surely

maxAgeReached = FileUtils.isFileOlder(file, new Date().getTime() - maxAge.get());

?

Activity

Show:
Lars Kiesow
October 22, 2015, 10:01 AM

you assigned this to yourself which made me stop working on this issue. Do you actually still work on this? Otherwise please assign this ticket to me and I will fix this.

Lukas Rohner
October 22, 2015, 11:30 AM

Feel free to work on it.

Lars Kiesow
October 22, 2015, 12:19 PM

ok, I'll then take over

Lars Kiesow
October 22, 2015, 9:59 PM

Good news first: The main issues of this ticket (ms vs s) are already fixed with commit 865669a3 from Lukas. But there are still a couple of issues that were described here in the comments left. I'll create a pull request to fix them as well.

Lars Kiesow
October 23, 2015, 8:31 PM

Done.

https://bitbucket.org/opencast-community/matterhorn/pull-requests/675
is a simplified version of the patch for 1.x that just makes sure the maxAge is interpreted correctly.

https://bitbucket.org/opencast-community/matterhorn/pull-requests/674
is a larger patch fot 2.1 which fixes all the issues that have been raised on this ticket, including all the comments.

Assignee

Lars Kiesow

Reporter

Stephen Marquard

Severity

Incorrectly Functioning Without Workaround

Tags (folksonomy)

None

Components

Fix versions

Affects versions

Priority

Critical
Configure