Merge pull request #13107 from overleaf/em-reenable-swap-job-test

Reenable swap job test in git bridge

GitOrigin-RevId: 4fcef9d1b9a6ef169b14ec490b785daeb80ab418
This commit is contained in:
Eric Mc Sween
2023-05-17 07:17:58 -04:00
committed by Copybot
parent ebbb4fd6d0
commit a5834a0f8c
3 changed files with 11 additions and 8 deletions

View File

@@ -64,7 +64,7 @@ public interface SwapJob {
if (!cfg.isPresent()) {
return new NoopSwapJob();
}
if (!swapStore.isSafe()) {
if (!swapStore.isSafe() && !cfg.get().getAllowUnsafeStores()) {
Log.warn("Swap store '{}' is not safe; disabling swap job", swapStore.getClass().getSimpleName());
return new NoopSwapJob();
}

View File

@@ -13,19 +13,22 @@ public class SwapJobConfig {
private final int highGiB;
private final long intervalMillis;
private final String compressionMethod;
private final boolean allowUnsafeStores;
public SwapJobConfig(
int minProjects,
int lowGiB,
int highGiB,
long intervalMillis,
String compressionMethod
String compressionMethod,
boolean allowUnsafeStores
) {
this.minProjects = minProjects;
this.lowGiB = lowGiB;
this.highGiB = highGiB;
this.intervalMillis = intervalMillis;
this.compressionMethod = compressionMethod;
this.allowUnsafeStores = allowUnsafeStores;
}
public int getMinProjects() {
@@ -44,6 +47,10 @@ public class SwapJobConfig {
return intervalMillis;
}
public boolean getAllowUnsafeStores() {
return allowUnsafeStores;
}
public SwapJob.CompressionMethod getCompressionMethod() {
CompressionMethod result = SwapJob.stringToCompressionMethod(compressionMethod);
if (result == null) {