Skip to content

Commit

Permalink
Reduce the release caching period to 3 days (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yurii Samsoniuk authored and sigito committed Feb 11, 2021
1 parent e413805 commit 7bad5fe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Sources/LingueeSearchWorkflow/LingueeSearchWorkflow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import Updater
fileprivate let kMinuteSeconds: TimeInterval = 60
/// Usual amount of secands in 5 minutes.
fileprivate let kFiveMituneSeconds = 5 * kMinuteSeconds
/// Usual amount of seconds per week.
fileprivate let kWeekSeconds = kMinuteSeconds * 60 * 24 * 7
/// The new release caching period.
fileprivate let kReleaseCacheExpirationInterval = kMinuteSeconds * 60 * 24 * 3 // 3 days

public class LingueeSearchWorkflow {
private static let logger = Logger(
Expand Down Expand Up @@ -50,7 +50,7 @@ public class LingueeSearchWorkflow {
return UpdateMonitor(
currentVersion: version,
requestInterval: kFiveMituneSeconds,
cacheExpirationInterval: kWeekSeconds,
cacheExpirationInterval: kReleaseCacheExpirationInterval,
localStore: localStore,
gitHubAPI: GitHubAPIImpl())
} catch {
Expand Down
3 changes: 3 additions & 0 deletions Sources/Updater/UpdateMonitor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class UpdateMonitor {
private let gitHubAPI: GitHubAPI
private var cancellables = Set<AnyCancellable>()

/// Paramaters:
/// - cacheExpirationInterval: the time interval to keep the available new release information
/// in a cache, instead of requesting a new one.
public init(
currentVersion: Version = .unknown,
requestInterval: TimeInterval,
Expand Down

0 comments on commit 7bad5fe

Please sign in to comment.