Skip to content

Commit f8b5fa8

Browse files
committed
Improved handling for when auth token not set up correctly
1 parent ca075e9 commit f8b5fa8

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

addons/quiver_analytics/analytics.gd

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
extends Node
2-
## This class handles sending events to Quiver Analytics.
2+
## Handles sending events to Quiver Analytics.
33
##
4-
## This class manages a request queue, that the plugin user can populate with events.
4+
## This class manages a request queue, which the plugin user can populate with events.
55
## Events are sent to the Quiver server one at a time.
66
## This class manages spacing out requests so as to not overload the server
77
## and to prevent performance issues in the game.
88
## If events are not able to be sent due to network connection issues,
99
## the events are saved to disk when the game exits.
1010
##
11-
## This class prefers performance over accuracy, so events may be dropped if
11+
## This implementation favors performance over accuracy, so events may be dropped if
1212
## they could lead to performance issues.
1313

1414

@@ -20,7 +20,7 @@ const MAX_INT := 9223372036854775807
2020
const MAX_ADD_TO_EVENT_QUEUE_RATE := 50
2121

2222
## This controls the maximum size of the request queue that is saved to disk
23-
## in the situation the events weren't able to be successfully sent
23+
## in the situation the events weren't able to be successfully sent.
2424
## In pathological cases, we may drop events if the queue grows too long.
2525
const MAX_QUEUE_SIZE_TO_SAVE_TO_DISK := 200
2626

@@ -175,7 +175,7 @@ func add_event(name: String, properties: Dictionary = {}) -> void:
175175
printerr("[Quiver Analytics] Event tracking was disabled temporarily because max event rate was exceeded.")
176176
return
177177

178-
# Auto-add the platform
178+
# Auto-add default properties
179179
properties["$platform"] = OS.get_name()
180180
properties["$session_id"] = session_id
181181
properties["$debug"] = OS.is_debug_build()
@@ -191,7 +191,8 @@ func add_event(name: String, properties: Dictionary = {}) -> void:
191191
_process_requests()
192192

193193

194-
## Must be called when a user exits the game.
194+
## Ideally, this should be called when a user exits the game,
195+
## although it may be difficult on certain plaforms.
195196
## This handles draining the request queue and saving the queue to disk, if necessary.
196197
func handle_exit():
197198
should_drain_request_queue = true
@@ -221,9 +222,10 @@ func _load_queue_from_disk() -> void:
221222

222223
func _handle_request_failure(response_code: int):
223224
request_in_flight = false
224-
# Drop invalid events
225-
# 5xx and transient errors will be presumed to be fixed server-side
225+
# Drop invalid 4xx events
226+
# 5xx and transient errors will be presumed to be fixed server-side.
226227
if response_code >= 400 and response_code <= 499:
228+
request_queue.pop_front()
227229
printerr("[Quiver Analytics] Event was dropped because it couldn't be processed by the server. Response code %d." % response_code)
228230
# If we are not in draining mode, we retry with exponential backoff
229231
if not should_drain_request_queue:

addons/quiver_analytics/plugin.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
name="Quiver Analytics"
44
description="Get key insights into how players are interacting with your game while still respecting their privacy."
55
author="Quiver"
6-
version="0.3"
6+
version="0.4"
77
script="plugin.gd"

0 commit comments

Comments
 (0)