mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-10 18:10:49 +09:00
GO-2050 Fix crash
This commit is contained in:
parent
129b2e70e5
commit
2d92f5c01f
2 changed files with 10 additions and 4 deletions
|
@ -61,8 +61,13 @@ func (c *Client) SendEvents(amplEvents []Event, info AppInfoProvider) error {
|
|||
req.Set("api_key", arena.NewString(c.key))
|
||||
|
||||
events := arena.NewArray()
|
||||
for i, ev := range amplEvents {
|
||||
ampEvent := *ev.MarshalFastJson(arena)
|
||||
amIndex := 0
|
||||
for _, ev := range amplEvents {
|
||||
tryEvent := ev.MarshalFastJson(arena)
|
||||
if tryEvent == nil {
|
||||
continue
|
||||
}
|
||||
ampEvent := *tryEvent
|
||||
ampEvent.Set("app_version", appVersion)
|
||||
ampEvent.Set("device_id", deviceId)
|
||||
ampEvent.Set("platform", platform)
|
||||
|
@ -70,7 +75,8 @@ func (c *Client) SendEvents(amplEvents []Event, info AppInfoProvider) error {
|
|||
ampEvent.Set("user_id", userId)
|
||||
ampEvent.Set("time", arena.NewNumberInt(int(ev.GetTimestamp())))
|
||||
|
||||
events.SetArrayItem(i, &Event)
|
||||
events.SetArrayItem(amIndex, &Event)
|
||||
amIndex++
|
||||
}
|
||||
|
||||
req.Set("events", events)
|
||||
|
|
|
@ -28,7 +28,7 @@ const (
|
|||
)
|
||||
|
||||
const amplEndpoint = "https://amplitude.anytype.io/2/httpapi"
|
||||
const inhouseEndpoint = "https://metrics.anytype.io/2/httpapi"
|
||||
const inhouseEndpoint = "https://telemetry.anytype.io/2/httpapi"
|
||||
|
||||
type SamplableEvent interface {
|
||||
amplitude.Event
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue