mirror of
https://github.com/ddworken/hishtory.git
synced 2025-06-24 05:51:38 +02:00
Fix bug in updateUsageData that caused it to not record usage data for newly created users
This commit is contained in:
parent
9fda54d4c2
commit
59119823f5
@ -5,6 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/DataDog/datadog-go/statsd"
|
"github.com/DataDog/datadog-go/statsd"
|
||||||
@ -152,7 +153,7 @@ func (s *Server) updateUsageData(ctx context.Context, version string, remoteAddr
|
|||||||
}
|
}
|
||||||
var usageData []shared.UsageData
|
var usageData []shared.UsageData
|
||||||
usageData, err := s.db.UsageDataFindByUserAndDevice(ctx, userId, deviceId)
|
usageData, err := s.db.UsageDataFindByUserAndDevice(ctx, userId, deviceId)
|
||||||
if err != nil {
|
if err != nil && !strings.Contains(err.Error(), "record not found") {
|
||||||
return fmt.Errorf("db.UsageDataFindByUserAndDevice: %w", err)
|
return fmt.Errorf("db.UsageDataFindByUserAndDevice: %w", err)
|
||||||
}
|
}
|
||||||
if len(usageData) == 0 {
|
if len(usageData) == 0 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user