Skip to content

Commit 2b6fe05

Browse files
committed
remove 'timestamp' field from track protocol messages
1 parent 3e57e08 commit 2b6fe05

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

improveai/src/main/java/ai/improve/DecisionTracker.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class DecisionTracker {
2828
private static final String GIVENS_KEY = "givens";
2929
private static final String RUNNERS_UP_KEY = "runners_up";
3030
public static final String SAMPLE_VARIANT_KEY = "sample";
31-
private static final String TIMESTAMP_KEY = "timestamp";
3231
private static final String MESSAGE_ID_KEY = "message_id";
3332
private static final String DECISION_ID_KEY = "decision_id";
3433
private static final String REWARD_KEY = "reward";
@@ -38,8 +37,6 @@ class DecisionTracker {
3837
private static final String CONTENT_TYPE_HEADER = "Content-Type";
3938
private static final String APPLICATION_JSON = "application/json";
4039

41-
private static final SimpleDateFormat ISO_TIMESTAMP_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.UK);
42-
4340
private static final int DEFAULT_MAX_RUNNERS_UP = 50;
4441

4542
private String trackURL;
@@ -242,19 +239,14 @@ private void postTrackingRequest(Map<String, Object> body) {
242239
headers.put(TRACK_API_KEY_HEADER, trackApiKey);
243240
}
244241

245-
body = new HashMap<>(body);
246-
body.put(TIMESTAMP_KEY, ISO_TIMESTAMP_FORMAT.format(new Date()));
247-
248-
Map<String, Object> finalBody = body;
249-
250242
// It's not allowed to send network request in the main thread on Android.
251243
new Thread() {
252244
@Override
253245
public void run() {
254246
try {
255247
// android.os.NetworkOnMainThreadException will be thrown if post() is called
256248
// in main thread
257-
HttpUtil.withUrl(trackURL).withHeaders(headers).withBody(finalBody).post();
249+
HttpUtil.withUrl(trackURL).withHeaders(headers).withBody(body).post();
258250
} catch (MalformedURLException e) {
259251
IMPLog.e(Tag, e.getLocalizedMessage());
260252
}

0 commit comments

Comments
 (0)