feat(backend/db): send metadata directly to db (removed from batches) (#544)
Co-authored-by: Alexander Zavorotynskiy <alexander@openreplay.com>
This commit is contained in:
parent
449890320e
commit
270e9ca46a
2 changed files with 6 additions and 3 deletions
|
|
@ -155,12 +155,11 @@ func (conn *Conn) InsertUserAnonymousID(sessionID uint64, userAnonymousID string
|
|||
}
|
||||
|
||||
func (conn *Conn) InsertMetadata(sessionID uint64, keyNo uint, value string) error {
|
||||
return conn.batchQueue(sessionID, fmt.Sprintf(`
|
||||
return conn.exec(fmt.Sprintf(`
|
||||
UPDATE sessions SET metadata_%v = $1
|
||||
WHERE session_id = $2`, keyNo),
|
||||
value, sessionID,
|
||||
)
|
||||
// conn.insertAutocompleteValue(sessionID, "METADATA", value)
|
||||
}
|
||||
|
||||
func (conn *Conn) InsertIssueEvent(sessionID uint64, projectID uint32, e *messages.IssueEvent) error {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
. "openreplay/backend/pkg/messages"
|
||||
)
|
||||
|
||||
|
|
@ -8,7 +9,10 @@ func insertMessage(sessionID uint64, msg Message) error {
|
|||
switch m := msg.(type) {
|
||||
// Common
|
||||
case *Metadata:
|
||||
return pg.InsertMetadata(sessionID, m)
|
||||
if err := pg.InsertMetadata(sessionID, m); err != nil {
|
||||
return fmt.Errorf("insert metadata err: %s", err)
|
||||
}
|
||||
return nil
|
||||
case *IssueEvent:
|
||||
return pg.InsertIssueEvent(sessionID, m)
|
||||
//TODO: message adapter (transformer) (at the level of pkg/message) for types:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue