Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,16 @@ public static class WriteDoFn extends DoFn<RedisMutation, Void> {
}

public WriteDoFn withBatchSize(int batchSize) {
if (batchSize > 0) this.batchSize = batchSize;
if (batchSize > 0) {
this.batchSize = batchSize;
}
return this;
}

public WriteDoFn withTimeout(int timeout) {
if (timeout > 0) this.timeout = timeout;
if (timeout > 0) {
this.timeout = timeout;
}
return this;
}

Expand All @@ -155,7 +159,6 @@ public void setup() {
@StartBundle
public void startBundle() {
pipeline = jedis.pipelined();
pipeline.multi();
batchCount = 0;
}

Expand All @@ -168,9 +171,7 @@ public void processElement(ProcessContext context) {
}
batchCount++;
if (batchCount >= batchSize) {
pipeline.exec();
pipeline.sync();
pipeline.multi();
batchCount = 0;
}
}
Expand All @@ -197,10 +198,7 @@ private Response<?> writeRecord(RedisMutation mutation) {

@FinishBundle
public void finishBundle() {
if (pipeline.isInMulti()) {
pipeline.exec();
pipeline.sync();
}
pipeline.sync();
batchCount = 0;
}

Expand Down