Skip to content

Commit

Permalink
Merge pull request #362 from mynaparrot/improve
Browse files Browse the repository at this point in the history
fixed deadlock
  • Loading branch information
jibon57 authored Oct 17, 2023
2 parents 922f94d + 380db48 commit 67cd2f1
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions pkg/models/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,11 @@ func (m *AnalyticsModel) HandleEvent(d *plugnmeet.AnalyticsDataMsg) {
!config.AppCnf.AnalyticsSettings.Enabled {
return
}

m.Lock()
defer m.Unlock()
// we'll use unix milliseconds to make sure fields are unique
d.Time = time.Now().UnixMilli()
m.data = d
m.Unlock()

switch d.EventType {
case plugnmeet.AnalyticsEventType_ANALYTICS_EVENT_TYPE_ROOM:
Expand Down Expand Up @@ -85,9 +84,6 @@ func (m *AnalyticsModel) HandleWebSocketData(dataMsg *plugnmeet.DataMessage) {
}

func (m *AnalyticsModel) handleRoomTypeEvents() {
m.Lock()
defer m.Unlock()

if m.data.EventName == plugnmeet.AnalyticsEvents_ANALYTICS_EVENT_UNKNOWN {
return
}
Expand All @@ -104,9 +100,6 @@ func (m *AnalyticsModel) handleRoomTypeEvents() {
}

func (m *AnalyticsModel) handleUserTypeEvents() {
m.Lock()
defer m.Unlock()

if m.data.EventName == plugnmeet.AnalyticsEvents_ANALYTICS_EVENT_UNKNOWN {
return
}
Expand Down

0 comments on commit 67cd2f1

Please sign in to comment.