Skip to content

Commit

Permalink
Fixed a minor issue regarding -syncAllSensorsForcefully
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuuki Nishiyama committed Nov 22, 2019
1 parent 2c8c380 commit de10895
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions AWAREFramework/Classes/Core/Sensor/AWARESensorManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -497,13 +497,19 @@ - (void)syncAllSensorsForcefully{
[AWAREEventLogger.shared logEvent:@{@"class":@"AWARESensorManager",@"event":@"sync: syncAllSensorsForcefully"}];
if (awareStudy.isDebug) NSLog(@"[AWARESensorManager] Start SyncDB forcefully");


int delaySec = 0;
for (AWARESensor * sensor in awareSensors ) {
if (awareStudy.isDebug) NSLog(@"%@",sensor.getSensorName);
// if (awareStudy.isDebug) NSLog(@"%@",sensor.getSensorName);
NSString * name = sensor.getSensorName;
if (name != nil){
[AWAREEventLogger.shared logEvent:@{@"class":@"AWARESensorManager", @"event":@"sync", @"sensor":name}];
}
[sensor startSyncDB];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delaySec * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[sensor startSyncDB];
if (self->awareStudy.isDebug) { NSLog(@"[AWARESensorManager|%@] sync + %d", name, delaySec); }
});
delaySec = delaySec + 1;
}
}

Expand Down
4 changes: 2 additions & 2 deletions AWAREFramework/Classes/Core/Storage/SQLite/SQLiteStorage.m
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ - (void)startSyncStorageWithCallBack:(SyncProcessCallBack)callback{

- (void)startSyncStorage {

if(self->isUploading){
if(isUploading){
NSString * message= [NSString stringWithFormat:@"[%@] Now sendsor data is uploading.", self.sensorName];
NSLog(@"%@", message);
return;
}

[self setRepetationCountAfterStartToSyncDB:[self getTimeMark]];
if (self.isDebug) NSLog(@"[SQLiteStorage:%@] start sync process ", self.sensorName);
self-> isUploading = YES;
isUploading = YES;

}

Expand Down

0 comments on commit de10895

Please sign in to comment.