Skip to content

Commit 99be7b4

Browse files
committed
Always run the update thread.
1 parent 40d70e9 commit 99be7b4

1 file changed

Lines changed: 11 additions & 16 deletions

File tree

lib/sdk/server/src/main/java/com/launchdarkly/sdk/server/integrations/FileDataSourceImpl.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,16 @@ final class FileDataSourceImpl implements DataSource {
3333
private final LDLogger logger;
3434
private Thread updateThread;
3535

36-
private final boolean autoUpdate;
37-
3836
FileDataSourceImpl(
39-
DataSourceUpdateSink dataSourceUpdates,
40-
List<SourceInfo> sources,
41-
boolean autoUpdate,
42-
FileData.DuplicateKeysHandling duplicateKeysHandling,
43-
LDLogger logger
37+
DataSourceUpdateSink dataSourceUpdates,
38+
List<SourceInfo> sources,
39+
boolean autoUpdate,
40+
FileData.DuplicateKeysHandling duplicateKeysHandling,
41+
LDLogger logger
4442
) {
4543
this.dataSourceUpdates = dataSourceUpdates;
4644
this.logger = logger;
4745
this.synchronizer = new FileSynchronizer(sources, autoUpdate, duplicateKeysHandling, logger, true);
48-
this.autoUpdate = autoUpdate;
4946
}
5047

5148
@Override
@@ -64,13 +61,11 @@ public Future<Void> start() {
6461

6562
processResult(initialResult);
6663

67-
// We only need to drive the update loop if auto-updating is enabled.
68-
if(autoUpdate) {
69-
// Start a background thread to listen for file changes
70-
updateThread = new Thread(this::runUpdateLoop, FileDataSourceImpl.class.getName());
71-
updateThread.setDaemon(true);
72-
updateThread.start();
73-
}
64+
// Start a background thread to listen for file changes
65+
updateThread = new Thread(this::runUpdateLoop, FileDataSourceImpl.class.getName());
66+
updateThread.setDaemon(true);
67+
updateThread.start();
68+
7469

7570
return initFuture;
7671
}
@@ -83,7 +78,7 @@ private void runUpdateLoop() {
8378
break;
8479
}
8580
if (result.getResultType() == FDv2SourceResult.ResultType.STATUS &&
86-
result.getStatus().getState() == FDv2SourceResult.State.SHUTDOWN) {
81+
result.getStatus().getState() == FDv2SourceResult.State.SHUTDOWN) {
8782
break;
8883
}
8984
processResult(result);

0 commit comments

Comments
 (0)