Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Performance Improvements #6

Merged
merged 9 commits into from
Feb 23, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add callback for retrieve
  • Loading branch information
Takeru Chuganji committed Feb 22, 2016
commit d9c5c258171bad3af1c0ed0d77ba7e8b89fce1e8
27 changes: 18 additions & 9 deletions Pod/Classes/PURBufferedOutput.m
Original file line number Diff line number Diff line change
@@ -82,7 +82,14 @@ - (void)start
{
[super start];

[self reloadLogStore];
[self.buffer removeAllObjects];
[self retrieveLogs:^(NSArray<PURLog *> * _Nonnull logs) {
if (![self.timer isValid]) {
return;
}
[self.buffer addObjectsFromArray:logs];
[self flush];
}];

[self setUpTimer];
}
@@ -91,7 +98,14 @@ - (void)resume
{
[super resume];

[self reloadLogStore];
[self.buffer removeAllObjects];
[self retrieveLogs:^(NSArray<PURLog *> * _Nonnull logs) {
if (![self.timer isValid]) {
return;
}
[self.buffer addObjectsFromArray:logs];
[self flush];
}];

[self setUpTimer];
}
@@ -110,17 +124,12 @@ - (void)tick
}
}

- (void)reloadLogStore
- (void)retrieveLogs:(PURLogStoreRetrieveCompletionBlock)completion
{
[self.buffer removeAllObjects];
[self.logStore retrieveLogsForPattern:self.tagPattern
output:self
completion:^(NSArray<PURLog *> *logs){
if ([self.timer isValid]) {
[self.buffer addObjectsFromArray:logs];
[self flush];
}
}];
completion:completion];
}

- (void)emitLog:(PURLog *)log