diff --git a/code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Optimize.java b/code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Optimize.java index f9e28db..ae536b6 100644 --- a/code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Optimize.java +++ b/code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Optimize.java @@ -89,7 +89,8 @@ public static void updatePropositions( @Nullable final Map xdm, @Nullable final Map data, @Nullable final AdobeCallback> callback) { - final double defaultTimeoutSeconds = OptimizeConstants.EDGE_CONTENT_COMPLETE_RESPONSE_TIMEOUT; + final double defaultTimeoutSeconds = + OptimizeConstants.EDGE_CONTENT_COMPLETE_RESPONSE_TIMEOUT; updatePropositionsInternal(decisionScopes, xdm, data, defaultTimeoutSeconds, callback); } @@ -177,7 +178,8 @@ private static void updatePropositionsInternal( eventData.put(OptimizeConstants.EventDataKeys.DATA, data); } - long timeoutMillis = (long) (timeoutSeconds * 1000); + long timeoutMillis = (long) (timeoutSeconds * OptimizeConstants.TIMEOUT_CONVERSION_FACTOR); + eventData.put(OptimizeConstants.EventDataKeys.TIMEOUT, timeoutMillis); final Event event = @@ -348,7 +350,7 @@ private static void getPropositionsInternal( .setEventData(eventData) .build(); - long timeoutMillis = (long) (timeoutSeconds * 1000); + long timeoutMillis = (long) (timeoutSeconds * OptimizeConstants.TIMEOUT_CONVERSION_FACTOR); MobileCore.dispatchEventWithResponseCallback( event, diff --git a/code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/OptimizeConstants.java b/code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/OptimizeConstants.java index c9933f6..d58f4f3 100644 --- a/code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/OptimizeConstants.java +++ b/code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/OptimizeConstants.java @@ -18,6 +18,7 @@ class OptimizeConstants { static final String FRIENDLY_NAME = "Optimize"; static final double GET_RESPONSE_CALLBACK_TIMEOUT = 10; static final double EDGE_CONTENT_COMPLETE_RESPONSE_TIMEOUT = 10; + static final long TIMEOUT_CONVERSION_FACTOR = 1000; static final String ACTIVITY_ID = "activityId"; static final String XDM_ACTIVITY_ID = "xdm:activityId"; diff --git a/code/optimize/src/test/java/com/adobe/marketing/mobile/optimize/OptimizeTests.java b/code/optimize/src/test/java/com/adobe/marketing/mobile/optimize/OptimizeTests.java index 90fc347..c26255c 100644 --- a/code/optimize/src/test/java/com/adobe/marketing/mobile/optimize/OptimizeTests.java +++ b/code/optimize/src/test/java/com/adobe/marketing/mobile/optimize/OptimizeTests.java @@ -10,6 +10,7 @@ */ package com.adobe.marketing.mobile.optimize; + import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify;