Skip to content

Commit f0b351d

Browse files
Make sure we don't check the invoke time for one way calls (#381)
1 parent 4cb588d commit f0b351d

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

sdk-core/src/main/java/dev/restate/sdk/core/Entries.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import io.opentelemetry.api.trace.Span;
2020
import java.nio.ByteBuffer;
2121
import java.util.Collection;
22+
import java.util.Objects;
2223
import java.util.function.Function;
2324
import java.util.stream.Collectors;
2425

@@ -425,9 +426,10 @@ void checkEntryHeader(CallEntryMessage expected, MessageLite actual) throws Prot
425426
}
426427
CallEntryMessage actualInvoke = (CallEntryMessage) actual;
427428

428-
if (!(expected.getServiceName().equals(actualInvoke.getServiceName())
429-
&& expected.getHandlerName().equals(actualInvoke.getHandlerName())
430-
&& expected.getParameter().equals(actualInvoke.getParameter()))) {
429+
if (!(Objects.equals(expected.getServiceName(), actualInvoke.getServiceName())
430+
&& Objects.equals(expected.getHandlerName(), actualInvoke.getHandlerName())
431+
&& Objects.equals(expected.getParameter(), actualInvoke.getParameter())
432+
&& Objects.equals(expected.getKey(), actualInvoke.getKey()))) {
431433
throw ProtocolException.entryDoesNotMatch(expected, actualInvoke);
432434
}
433435
}
@@ -452,11 +454,11 @@ public Result<R> parseCompletionResult(CompletionMessage actual) {
452454
}
453455
}
454456

455-
static final class BackgroundInvokeEntry extends JournalEntry<OneWayCallEntryMessage> {
457+
static final class OneWayCallEntry extends JournalEntry<OneWayCallEntryMessage> {
456458

457-
static final BackgroundInvokeEntry INSTANCE = new BackgroundInvokeEntry();
459+
static final OneWayCallEntry INSTANCE = new OneWayCallEntry();
458460

459-
private BackgroundInvokeEntry() {}
461+
private OneWayCallEntry() {}
460462

461463
@Override
462464
public void trace(OneWayCallEntryMessage expected, Span span) {
@@ -477,7 +479,17 @@ String getName(OneWayCallEntryMessage expected) {
477479
@Override
478480
void checkEntryHeader(OneWayCallEntryMessage expected, MessageLite actual)
479481
throws ProtocolException {
480-
Util.assertEntryEquals(expected, actual);
482+
if (!(actual instanceof OneWayCallEntryMessage)) {
483+
throw ProtocolException.entryDoesNotMatch(expected, actual);
484+
}
485+
OneWayCallEntryMessage actualInvoke = (OneWayCallEntryMessage) actual;
486+
487+
if (!(Objects.equals(expected.getServiceName(), actualInvoke.getServiceName())
488+
&& Objects.equals(expected.getHandlerName(), actualInvoke.getHandlerName())
489+
&& Objects.equals(expected.getParameter(), actualInvoke.getParameter())
490+
&& Objects.equals(expected.getKey(), actualInvoke.getKey()))) {
491+
throw ProtocolException.entryDoesNotMatch(expected, actualInvoke);
492+
}
481493
}
482494
}
483495

sdk-core/src/main/java/dev/restate/sdk/core/SyscallsImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public void send(
219219
}
220220

221221
this.stateMachine.processJournalEntry(
222-
builder.build(), BackgroundInvokeEntry.INSTANCE, callback);
222+
builder.build(), OneWayCallEntry.INSTANCE, callback);
223223
},
224224
callback);
225225
}

0 commit comments

Comments
 (0)