mirror of
https://github.com/sparkle-project/Sparkle
synced 2026-11-26 04:57:54 +00:00
As discussed in https://bugs.launchpad.net/sparkle/+bug/243884/comments/11, this patch makes it so that system profiling is only submitted to the server once per week. This will normalize clients' users: those which check daily won't count much more than those which check weekly. Thanks to David Smith for the patch.
This commit is contained in:
commit
d1c0978ee5
3 files changed
+13
No files matched your search
@@ -29,6 +29,7 @@ extern NSString *SUEnableAutomaticChecksKey;
|
||||
extern NSString *SUEnableAutomaticChecksKeyOld;
|
||||
extern NSString *SUEnableSystemProfilingKey;
|
||||
extern NSString *SUSendProfileInfoKey;
|
||||
extern NSString *SULastProfileSubmitDateKey;
|
||||
|
||||
extern NSString *SUSparkleErrorDomain;
|
||||
// Appcast phase errors.
|
||||
|
||||
@@ -27,6 +27,7 @@ NSString *SUEnableSystemProfilingKey = @"SUEnableSystemProfiling";
|
||||
NSString *SUEnableAutomaticChecksKey = @"SUEnableAutomaticChecks";
|
||||
NSString *SUEnableAutomaticChecksKeyOld = @"SUCheckAtStartup";
|
||||
NSString *SUSendProfileInfoKey = @"SUSendProfileInfo";
|
||||
NSString *SULastProfileSubmitDateKey = @"SULastProfileSubmissionDate";
|
||||
|
||||
NSString *SUSparkleErrorDomain = @"SUSparkleErrorDomain";
|
||||
OSStatus SUAppcastParseError = 1000;
|
||||
|
||||
+11
@@ -282,11 +282,22 @@ static NSString *SUUpdaterDefaultsObservationContext = @"SUUpdaterDefaultsObserv
|
||||
|
||||
// Determine all the parameters we're attaching to the base feed URL.
|
||||
BOOL sendingSystemProfile = ([host boolForUserDefaultsKey:SUSendProfileInfoKey] == YES);
|
||||
|
||||
// Let's only send the system profiling information once per week at most, so we normalize daily-checkers vs. biweekly-checkers and the such.
|
||||
NSDate *lastSubmitDate = [host objectForUserDefaultsKey:SULastProfileSubmitDateKey];
|
||||
if(!lastSubmitDate)
|
||||
lastSubmitDate = [NSDate distantPast];
|
||||
const NSTimeInterval oneWeek = 60 * 60 * 24 * 7;
|
||||
sendingSystemProfile &= (-[lastSubmitDate timeIntervalSinceNow] >= oneWeek);
|
||||
|
||||
NSArray *parameters = [NSArray array];
|
||||
if ([delegate respondsToSelector:@selector(feedParametersForUpdater:sendingSystemProfile:)])
|
||||
parameters = [parameters arrayByAddingObjectsFromArray:[delegate feedParametersForUpdater:self sendingSystemProfile:sendingSystemProfile]];
|
||||
if (sendingSystemProfile)
|
||||
{
|
||||
parameters = [parameters arrayByAddingObjectsFromArray:[host systemProfile]];
|
||||
[host setObject:[NSDate date] forUserDefaultsKey:SULastProfileSubmitDateKey];
|
||||
}
|
||||
if (parameters == nil || [parameters count] == 0) { return baseFeedURL; }
|
||||
|
||||
// Build up the parameterized URL.
|
||||
|
||||
Reference in new issue
Block a user