Merge branch 'charlesmchen/tweakProfileFetch2'
This commit is contained in:
commit
48e8c18251
|
@ -40,16 +40,20 @@ class ProfileFetcherJob: NSObject {
|
||||||
|
|
||||||
public func getProfile(recipientId: String, remainingRetries: Int = 3) {
|
public func getProfile(recipientId: String, remainingRetries: Int = 3) {
|
||||||
|
|
||||||
if let lastDate = ProfileFetcherJob.fetchDateMap[recipientId] {
|
// Only throttle profile fetch in production builds in order to
|
||||||
let lastTimeInterval = fabs(lastDate.timeIntervalSinceNow)
|
// facilitate debugging.
|
||||||
// Don't check a profile more often than every N minutes.
|
if !_isDebugAssertConfiguration() {
|
||||||
let kGetProfileMaxFrequencySeconds = 60.0 * 5.0
|
if let lastDate = ProfileFetcherJob.fetchDateMap[recipientId] {
|
||||||
if lastTimeInterval < kGetProfileMaxFrequencySeconds {
|
let lastTimeInterval = fabs(lastDate.timeIntervalSinceNow)
|
||||||
Logger.info("\(self.TAG) skipping getProfile: \(recipientId), lastTimeInterval: \(lastTimeInterval)")
|
// Don't check a profile more often than every N minutes.
|
||||||
return
|
let kGetProfileMaxFrequencySeconds = 60.0 * 5.0
|
||||||
|
if lastTimeInterval < kGetProfileMaxFrequencySeconds {
|
||||||
|
Logger.info("\(self.TAG) skipping getProfile: \(recipientId), lastTimeInterval: \(lastTimeInterval)")
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
ProfileFetcherJob.fetchDateMap[recipientId] = Date()
|
||||||
}
|
}
|
||||||
ProfileFetcherJob.fetchDateMap[recipientId] = Date()
|
|
||||||
|
|
||||||
Logger.error("\(self.TAG) getProfile: \(recipientId)")
|
Logger.error("\(self.TAG) getProfile: \(recipientId)")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue