Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Commit

Permalink
fix (auto-update): Fix auto-updating parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Asa Schachar committed Jun 10, 2019
1 parent 241abce commit ab98118
Show file tree
Hide file tree
Showing 7 changed files with 1,041 additions and 148 deletions.
2 changes: 1 addition & 1 deletion demo/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const optimizely = optimizelyExpressSdk.initialize({
sdkKey: 'CZsVVgn6j9ce6fNPt2ZEiB',
datafileOptions: {
autoUpdate: true,
updateInterval: 600000 // 10 minutes in milliseconds
updateInterval: 5*1000 // 5 seconds in milliseconds
},
});
app.use(optimizely.middleware);
Expand Down
13 changes: 9 additions & 4 deletions demo/express-sdk.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Optimizely Express SDK
* Optimizely Express Middleware
*
* Copyright 2019, Optimizely
*
Expand Down Expand Up @@ -40,13 +40,15 @@ function initialize(options) {
sdkKey,
datafile,
logLevel,
datafileOptions,
} = options;


const defaultLogger = require('@optimizely/optimizely-sdk').logging;
const manager = new DatafileManager({
sdkKey,
...options
...options,
...datafileOptions,
});

function updateDatafile() {
Expand Down Expand Up @@ -76,7 +78,10 @@ function initialize(options) {
logger: defaultLogger.createLogger({
logLevel: logLevel
}),
...options
...options,
datafileOptions: {
autoUpdate: false, // Ensure the SDK doesn't also try to auto-update on its own
},
});

req.optimizely = {
Expand Down Expand Up @@ -140,7 +145,7 @@ function initialize(options) {
},

/**
* isRouteEnabled
* isRouteEnabled (EXPERIMENTAL-FEATURE)
*
* Provides a method which can be used to block a route in express on whether the feature is enabled or not
*
Expand Down
Loading

0 comments on commit ab98118

Please sign in to comment.