Skip to content

Commit

Permalink
NO-SNOW Fix flaky test using multiple threads (snowflakedb#790)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-lsembera authored and sfc-gh-kgaputis committed Sep 12, 2024
1 parent c98252e commit f0100f1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,16 @@ private void ingestRandomRowsToTable(
boolean isNullable)
throws ExecutionException, InterruptedException {

List<Map<String, Object>> rows = new ArrayList<>();
final List<Map<String, Object>> rows = Collections.synchronizedList(new ArrayList<>());
for (int i = 0; i < batchSize; i++) {
Random r = new Random();
rows.add(TestUtils.getRandomRow(r, isNullable));
}

ExecutorService testThreadPool = Executors.newFixedThreadPool(numChannels);
CompletableFuture[] futures = new CompletableFuture[numChannels];
List<SnowflakeStreamingIngestChannel> channelList = new ArrayList<>();
List<SnowflakeStreamingIngestChannel> channelList =
Collections.synchronizedList(new ArrayList<>());
for (int i = 0; i < numChannels; i++) {
final String channelName = "CHANNEL" + i;
int finalI = i;
Expand Down

0 comments on commit f0100f1

Please sign in to comment.