Skip to content

Commit 56ac4eb

Browse files
committed
chore_: add emit-time timestamp to signal event
Required for DST chat protocol benchmarks. There might be delays between when a signal is emitted and when it is received by the test instance due to network conditions. Adding the timestamp at emit time addresses this.
1 parent e16dc91 commit 56ac4eb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

signal/signals.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ extern void SetEventCallback(void *cb);
1010
import "C"
1111
import (
1212
"encoding/json"
13+
"time"
1314
"unsafe"
1415

1516
"sync"
@@ -32,15 +33,17 @@ var logger = logutils.ZapLogger().Named("signal")
3233

3334
// Envelope is a general signal sent upward from node to RN app
3435
type Envelope struct {
35-
Type string `json:"type"`
36-
Event interface{} `json:"event"`
36+
Type string `json:"type"`
37+
Event interface{} `json:"event"`
38+
Timestamp int64 `json:"timestamp"`
3739
}
3840

3941
// NewEnvelope creates new envlope of given type and event payload.
4042
func NewEnvelope(typ string, event interface{}) *Envelope {
4143
return &Envelope{
42-
Type: typ,
43-
Event: event,
44+
Type: typ,
45+
Event: event,
46+
Timestamp: time.Now().Unix(),
4447
}
4548
}
4649

0 commit comments

Comments
 (0)