Skip to content

Commit

Permalink
fix: analytics
Browse files Browse the repository at this point in the history
* fix: add flag check while sending events

* fix: reconnected event not sent

* build: update versions for release

* ci: disable main check in publish

* ci: publish wf

* revert: publish workflow change

Co-authored-by: raviteja83 <[email protected]>
  • Loading branch information
eswarclynn and raviteja83 authored Jun 14, 2022
1 parent 64fa736 commit 8a37648
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ export class AnalyticsEventsService {
HTTPAnalyticsTransport.flushFailedEvents();
}

// eslint-disable-next-line complexity
flush() {
try {
while (this.pendingEvents.length > 0) {
const event = this.pendingEvents.shift();
if (event) {
event.metadata.peerId = this.store.getLocalPeer()?.peerId;
if (this.transport && this.transport.transportProvider.isConnected) {
if (this.transport && (this.transport.transportProvider.isConnected || !window.HMS?.CLIENT_EVENTS)) {
this.transport.sendEvent(event);
} else {
this.sendClientEventOnHTTP(event);
Expand Down
2 changes: 1 addition & 1 deletion packages/hms-video-web/src/analytics/AnalyticsTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export abstract class AnalyticsTransport {
const event = this.failedEvents.dequeue();
if (event) {
const isEventFromCurrentPeer = event.metadata?.peerId === currentPeerId;
if (isEventFromCurrentPeer || !event.metadata.peerId) {
if ([isEventFromCurrentPeer, !event.metadata.peerId, !window.HMS?.CLIENT_EVENTS].some(value => !!value)) {
this.sendSingleEvent(event);
} else {
HTTPAnalyticsTransport.sendEvent(event);
Expand Down

0 comments on commit 8a37648

Please sign in to comment.