Skip to content

Commit

Permalink
don't send requests if the batch is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Rockman committed Sep 25, 2019
1 parent b4e23c8 commit dd1efe2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Mixpanel/MixpanelManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ private IEnumerator DoRequest(string url, PersistentQueue queue, int retryCount
batch.Add(JsonUtility.FromJson<Value>(Encoding.UTF8.GetString(data)));
++count;
}

// If the batch is empty don't send the request
if (count == 0) yield break;
string payload = Convert.ToBase64String(Encoding.UTF8.GetBytes(batch.ToString()));
if (MixpanelSettings.Instance.ShowDebug) Debug.Log($"[Mixpanel] Sending Request - '{url}' with payload '{payload}'");
WWWForm form = new WWWForm();
Expand Down

0 comments on commit dd1efe2

Please sign in to comment.