Skip to content

Commit

Permalink
fix: add etag to batch upload payload
Browse files Browse the repository at this point in the history
  • Loading branch information
mchuangatmp committed Mar 8, 2022
1 parent 0f4446d commit 098b4c1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public interface MessageKey {
String ACCURACY = "acc";
// batch details
String MPARTICLE_VERSION = "sdk";
String MPARTICLE_CONFIG_VERSION = "mpcv";
String APP_INFO = "ai";
String DEVICE_INFO = "di";
String USER_ATTRIBUTES = "ua";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public void fetchConfig(boolean force) throws IOException, MPConfigException {
String newModified = connection.getHeaderField("Last-Modified");

mConfigManager.updateConfig(response, newEtag, newModified);
}else if (connection.getResponseCode() == 400) {
} else if (connection.getResponseCode() == 400) {
throw new MPConfigException();
} else if (connection.getResponseCode() == 304) {
Logger.verbose("Config request deferred, configuration already up-to-date.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
package com.mparticle.internal;

import static com.mparticle.internal.Constants.MessageKey.DATA_PLAN_CONTEXT;
import static com.mparticle.internal.Constants.MessageKey.DATA_PLAN_ID;
import static com.mparticle.internal.Constants.MessageKey.DATA_PLAN_KEY;
import static com.mparticle.internal.Constants.MessageKey.DATA_PLAN_VERSION;

import com.mparticle.BuildConfig;
import com.mparticle.MParticle;
import com.mparticle.consent.CCPAConsent;
Expand All @@ -11,15 +16,9 @@
import org.json.JSONException;
import org.json.JSONObject;

import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

import static com.mparticle.internal.Constants.MessageKey.DATA_PLAN_CONTEXT;
import static com.mparticle.internal.Constants.MessageKey.DATA_PLAN_ID;
import static com.mparticle.internal.Constants.MessageKey.DATA_PLAN_KEY;
import static com.mparticle.internal.Constants.MessageKey.DATA_PLAN_VERSION;

public class MessageBatch extends JSONObject {
private long messageLengthBytes;

Expand All @@ -38,6 +37,7 @@ public static MessageBatch create(boolean history, ConfigManager configManager,
uploadMessage.put(Constants.MessageKey.MPARTICLE_VERSION, Constants.MPARTICLE_VERSION);
uploadMessage.put(Constants.MessageKey.OPT_OUT_HEADER, configManager.getOptedOut());
uploadMessage.put(Constants.MessageKey.CONFIG_UPLOAD_INTERVAL, configManager.getUploadInterval()/1000);
uploadMessage.put(Constants.MessageKey.MPARTICLE_CONFIG_VERSION, Constants.PrefKeys.ETAG);
uploadMessage.put(Constants.MessageKey.CONFIG_SESSION_TIMEOUT, configManager.getSessionTimeout()/1000);
uploadMessage.put(Constants.MessageKey.MPID, String.valueOf(batchId.getMpid()));
uploadMessage.put(Constants.MessageKey.SANDBOX, configManager.getEnvironment().equals(MParticle.Environment.Development));
Expand Down
2 changes: 1 addition & 1 deletion release.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = {
{
assets: ["CHANGELOG.md", "build.gradle", "README.md"],
message:
"chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}",
"chore(release): ${nextRelease.version} \n\n${nextRelease.notes}",
},
],
],
Expand Down

0 comments on commit 098b4c1

Please sign in to comment.