Skip to content

Commit 82bcd6f

Browse files
authored
feat(operator/eos): Use 'now' as built time if debug build (#1100)
feat(operator): Use 'now' as built time if debug build
1 parent 0dc40bc commit 82bcd6f

File tree

1 file changed

+12
-6
lines changed
  • crates/stackable-operator/src/eos

1 file changed

+12
-6
lines changed

crates/stackable-operator/src/eos/mod.rs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,18 @@ impl EndOfSupportChecker {
8282
..
8383
} = options;
8484

85-
// Parse the built-time from the RFC2822-encoded string and add the support duration to it.
86-
// This is datetime marks the end-of-support date.
87-
let datetime = DateTime::parse_from_rfc2822(built_time)
88-
.context(ParseBuiltTimeSnafu)?
89-
.to_utc()
90-
+ *support_duration;
85+
// Parse the built-time from the RFC2822-encoded string when this is compiled as a release
86+
// build. If this is a debug/dev build, use the current datetime instead.
87+
let mut datetime = if cfg!(debug_assertions) {
88+
Utc::now()
89+
} else {
90+
DateTime::parse_from_rfc2822(built_time)
91+
.context(ParseBuiltTimeSnafu)?
92+
.to_utc()
93+
};
94+
95+
// Add the support duration to the built date. This marks the end-of-support date.
96+
datetime += *support_duration;
9197

9298
Ok(Self { datetime, interval })
9399
}

0 commit comments

Comments
 (0)