Skip to content

Commit

Permalink
Merge pull request #215 from optimizely/tightenDownEventDispatchInterval
Browse files Browse the repository at this point in the history
(chore): Tighten down event dispatch interval
  • Loading branch information
jaeopt authored May 30, 2019
2 parents a351729 + 6b8bbef commit b1fd856
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This modernized version of the SDK is meant to replace the Objective-C SDK.
### New Features
* 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.
* 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.
* The event handler batches events and will run every 5 minutes in the foreground to send events.
* 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.

### Bug Fixes:

Expand Down
10 changes: 5 additions & 5 deletions OptimizelySDK/Customization/DefaultEventDispatcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ open class DefaultEventDispatcher : BackgroundingCallbacks, OPTEventDispatcher {
static let MAX_FAILURE_COUNT = 3

// default timerInterval
var timerInterval:TimeInterval = 60 * 5 // every five minutes
var timerInterval:TimeInterval // every minute
// default batchSize.
// attempt to send events in batches with batchSize number of events combined
var batchSize:Int = 10
var batchSize:Int
// start trimming the front of the queue when we get to over maxQueueSize
// TODO: implement
var maxQueueSize:Int = 30000

lazy var logger = OPTLoggerFactory.getLogger()
var backingStore:DataStoreType = .file
var backingStoreName:String = "OPTEventQueue"
var backingStore:DataStoreType
var backingStoreName:String

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

public init(batchSize:Int = 10, backingStore:DataStoreType = .file, dataStoreName:String = "OPTEventQueue", timerInterval:TimeInterval = 60*5 ) {
public init(batchSize:Int = 10, backingStore:DataStoreType = .file, dataStoreName:String = "OPTEventQueue", timerInterval:TimeInterval = 60*1 ) {
self.batchSize = batchSize > 0 ? batchSize : 1
self.backingStore = backingStore
self.backingStoreName = dataStoreName
Expand Down

0 comments on commit b1fd856

Please sign in to comment.