Skip to content

Commit

Permalink
dcache-bulk: small improvement to RB 13915
Browse files Browse the repository at this point in the history
Motivation:

Reduce number of conditional checks in fix #13915.

Modification:

Use single if-else and `optString`.

Result:

Code less verbose and "more efficient".

Target: master
Request: 8.2
Patch: https://rb.dcache.org/r/13916/
Requires-notes: no
Acked-by: Dmitry
Committed: master@
Pull-request:  cherry-picked to #7047
  • Loading branch information
alrossi committed Mar 10, 2023
1 parent 8f0653e commit 44701e6
Showing 1 changed file with 2 additions and 11 deletions.
Expand Up @@ -152,17 +152,8 @@ private ProtocolInfo getProtocolInfo() throws URISyntaxException {
}

private long getLifetimeInMillis(FsPath path) {
String ptString = null;

String key = path.toString();

if (jsonLifetimes != null && jsonLifetimes.has(key)) {
ptString = jsonLifetimes.getString(key);
}

if (ptString == null) {
ptString = DISK_LIFETIME.getDefaultValue();
}
String ptString = jsonLifetimes == null ? DISK_LIFETIME.getDefaultValue()
: jsonLifetimes.optString(path.toString(), DISK_LIFETIME.getDefaultValue());

return TimeUnit.SECONDS.toMillis(Duration.parse(ptString).get(ChronoUnit.SECONDS));
}
Expand Down

0 comments on commit 44701e6

Please sign in to comment.