Skip to content

Commit b1fd856

Browse files
authored
Merge pull request #215 from optimizely/tightenDownEventDispatchInterval
(chore): Tighten down event dispatch interval
2 parents a351729 + 6b8bbef commit b1fd856

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This modernized version of the SDK is meant to replace the Objective-C SDK.
1010
### New Features
1111
* By default the datafile handler does updates every 10 minutes when the application is in the foreground. To disable this, set the periodicUpdateInterval to zero. If you do allow for polling, the project will update automatically when a new datafile change is received.
1212
* On top of the above functionality, the developer may register for a datafile change notification. This notification will be called anytime a new datafile is downloaded to cache and is used to reinitialize the optimizely client automatically.
13-
* The event handler batches events and will run every 5 minutes in the foreground to send events.
13+
* The event handler batches events and will run every minute in the foreground to send events. If there are no events in the queue it will not reschedule.
1414

1515
### Bug Fixes:
1616

OptimizelySDK/Customization/DefaultEventDispatcher.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@ open class DefaultEventDispatcher : BackgroundingCallbacks, OPTEventDispatcher {
2828
static let MAX_FAILURE_COUNT = 3
2929

3030
// default timerInterval
31-
var timerInterval:TimeInterval = 60 * 5 // every five minutes
31+
var timerInterval:TimeInterval // every minute
3232
// default batchSize.
3333
// attempt to send events in batches with batchSize number of events combined
34-
var batchSize:Int = 10
34+
var batchSize:Int
3535
// start trimming the front of the queue when we get to over maxQueueSize
3636
// TODO: implement
3737
var maxQueueSize:Int = 30000
3838

3939
lazy var logger = OPTLoggerFactory.getLogger()
40-
var backingStore:DataStoreType = .file
41-
var backingStoreName:String = "OPTEventQueue"
40+
var backingStore:DataStoreType
41+
var backingStoreName:String
4242

4343
// for dispatching events
4444
let dispatcher = DispatchQueue(label: "DefaultEventDispatcherQueue")
@@ -47,7 +47,7 @@ open class DefaultEventDispatcher : BackgroundingCallbacks, OPTEventDispatcher {
4747
// timer as a atomic property.
4848
var timer:AtomicProperty<Timer> = AtomicProperty<Timer>()
4949

50-
public init(batchSize:Int = 10, backingStore:DataStoreType = .file, dataStoreName:String = "OPTEventQueue", timerInterval:TimeInterval = 60*5 ) {
50+
public init(batchSize:Int = 10, backingStore:DataStoreType = .file, dataStoreName:String = "OPTEventQueue", timerInterval:TimeInterval = 60*1 ) {
5151
self.batchSize = batchSize > 0 ? batchSize : 1
5252
self.backingStore = backingStore
5353
self.backingStoreName = dataStoreName

0 commit comments

Comments
 (0)