Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigation: timers synchronization #33

Draft
wants to merge 11 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 6 commits
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
2 changes: 0 additions & 2 deletions DetoxSync/DetoxSync.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,6 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = NO;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand Down Expand Up @@ -1255,7 +1254,6 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = NO;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = NO;
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
Expand Down
26 changes: 19 additions & 7 deletions DetoxSync/DetoxSync/Spies/NSTimer+DTXSpy.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ static void _DTXCFTimerTrampoline(CFRunLoopTimerRef timer, void *info)
// NSLog(@"❤️ %p", timer);

id<DTXTimerProxy> tp = [DTXTimerSyncResource existingTimerProxyWithTimer:NS(timer)];
[tp fire:(__bridge NSTimer*)timer];
[tp fire];
}

static CFRunLoopTimerRef (*__orig_CFRunLoopTimerCreate)(CFAllocatorRef allocator, CFAbsoluteTime fireDate, CFTimeInterval interval, CFOptionFlags flags, CFIndex order, CFRunLoopTimerCallBack callout, CFRunLoopTimerContext *context);
Expand All @@ -72,6 +72,9 @@ CFRunLoopTimerRef __detox_sync_CFRunLoopTimerCreate(CFAllocatorRef allocator, CF
static CFRunLoopTimerRef (*__orig_CFRunLoopTimerCreateWithHandler)(CFAllocatorRef allocator, CFAbsoluteTime fireDate, CFTimeInterval interval, CFOptionFlags flags, CFIndex order, void (^block) (CFRunLoopTimerRef timer));
CFRunLoopTimerRef __detox_sync_CFRunLoopTimerCreateWithHandler(CFAllocatorRef allocator, CFAbsoluteTime fireDate, CFTimeInterval interval, CFOptionFlags flags, CFIndex order, void (^block) (id timer))
{
NSLog(@"🤔 CFRunLoopTimerCreateWithHandler");

// What is this doing? We don't seem to be creating a trampoline here - I feel like we should be?
return (__bridge_retained CFRunLoopTimerRef)[[NSTimer alloc] initWithFireDate:CFBridgingRelease(CFDateCreate(allocator, fireDate)) interval:interval repeats:interval > 0 block:block];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why we're swizzling CFRunLoopTimerCreateWithHandler without adding any tracking for these timers (as far as I can tell).

Unless initWithFireDate somehow ends up calling CFRunLoopTimerCreate?

Copy link
Contributor Author

@ball-hayden ball-hayden Apr 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens a lot when running the Detox example app.
I don't understand what this is doing.

Copy link
Contributor

@asafkorem asafkorem Apr 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless initWithFireDate somehow ends up calling CFRunLoopTimerCreate

Probably yes. This can be easily checked by putting a breakpoint on __detox_sync_CFRunLoopTimerCreate.
https://github.com/wix/DetoxSync/tree/master/ExampleApp

}

Expand All @@ -94,9 +97,9 @@ void __detox_sync_CFRunLoopRemoveTimer(CFRunLoopRef rl, CFRunLoopTimerRef timer,
// NSLog(@"🤦‍♂️ removeTimer: %@", NS(timer));

id<DTXTimerProxy> trampoline = [DTXTimerSyncResource existingTimerProxyWithTimer:NS(timer)];
[trampoline untrack];

__orig_CFRunLoopRemoveTimer(rl, timer, mode);

[trampoline untrack];
Comment on lines 99 to +102
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've observed that [_DTXTimerTrampoline fire:] is called after the trampoline has been untracked (and therefore dealloced).

By switching these, I was hoping that the timer would be cancelled (ensuring that the fire method is not called after untracking).

This doesn't seem to be the case, and I'm still seeing fire called after the trampoline has been untracked, but it still feels safer to me to remove the timer before untracking?

Copy link
Contributor

@asafkorem asafkorem Apr 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untracking the timer only after removing it from the runloop does make sense, but I'm not sure if it matters.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[_DTXTimerTrampoline fire:] is called after the trampoline has been untracked

That's very weird. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the thread where this timer was created and the thread where the timer was called to invalidate are different?

Apple docs (invalidate()):

You must send this message from the thread on which the timer was installed. If you send this message from another thread, the input source associated with the timer may not be removed from its run loop, which could prevent the thread from exiting properly.

}

static void (*__orig_CFRunLoopTimerInvalidate)(CFRunLoopTimerRef timer);
Expand All @@ -105,9 +108,9 @@ void __detox_sync_CFRunLoopTimerInvalidate(CFRunLoopTimerRef timer)
// NSLog(@"🤦‍♂️ invalidate: %@", NS(timer));

id<DTXTimerProxy> trampoline = [DTXTimerSyncResource existingTimerProxyWithTimer:NS(timer)];
[trampoline untrack];

__orig_CFRunLoopTimerInvalidate(timer);

[trampoline untrack];
}

static void (*__orig___NSCFTimer_invalidate)(NSTimer* timer);
Expand All @@ -116,11 +119,20 @@ void __detox_sync___NSCFTimer_invalidate(NSTimer* timer)
// NSLog(@"🤦‍♂️ invalidate: %@", timer);

id<DTXTimerProxy> trampoline = [DTXTimerSyncResource existingTimerProxyWithTimer:timer];
[trampoline untrack];

__orig___NSCFTimer_invalidate(timer);

[trampoline untrack];
}

- (void)dealloc
{
id<DTXTimerProxy> trampoline = [DTXTimerSyncResource existingTimerProxyWithTimer:self];

if(trampoline) {
NSLog(@"🤦‍♂️ dealloc, but trampoline was still active: %@", self);
[trampoline untrack];
}
}
Comment on lines +127 to +135
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding this makes it safe to remove _DTXCleanTimersAndReturnCount (since we've then got a nicer way of calling untrack if the timer is dealloced)?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sense.


+ (void)load
{
Expand Down
2 changes: 1 addition & 1 deletion DetoxSync/DetoxSync/SyncResources/DTXTimerSyncResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ NS_ASSUME_NONNULL_BEGIN

//NSTimer
@property (nonatomic, weak) NSTimer* timer;
- (void)fire:(NSTimer*)timer;
- (void)fire;
@property (nonatomic) CFRunLoopRef runLoop;

//CADisplayLink
Expand Down
26 changes: 6 additions & 20 deletions DetoxSync/DetoxSync/SyncResources/DTXTimerSyncResource.m
Original file line number Diff line number Diff line change
Expand Up @@ -86,30 +86,16 @@ + (instancetype)sharedInstance
shared = [DTXTimerSyncResource new];
[DTXSyncManager registerSyncResource:shared];
});

return shared;
}

/// Ugly hack for rare occasions where NSTimer gets released, but its associated objects are not released.
static NSUInteger _DTXCleanTimersAndReturnCount(NSMutableSet* _timers, NSMutableArray<NSString*(^)(void)>* eventIdentifiers)
{
for (_DTXTimerTrampoline* trampoline in _timers.copy) {
if(trampoline.isDead)
{
[eventIdentifiers addObject:_DTXStringReturningBlock([NSString stringWithFormat:@"%p", trampoline])];
[_timers removeObject:trampoline];
}
}

return _timers.count;
return shared;
}

- (void)clearTimerTrampolinesForCFRunLoop:(CFRunLoopRef)cfRunLoop
{
__block NSMutableArray<NSString*(^)(void)>* eventIdentifiers = [NSMutableArray new];

[self performMultipleUpdateBlock:^{
return _DTXCleanTimersAndReturnCount(_timers, eventIdentifiers);
return _timers.count;
} eventIdentifiers:_DTXObjectReturningBlock(eventIdentifiers)
eventDescriptions:nil
objectDescriptions:nil
Expand All @@ -131,7 +117,7 @@ - (void)trackTimerTrampoline:(_DTXTimerTrampoline *)trampoline
trampoline.jsonDescription])];
[_timers addObject:trampoline];

return _DTXCleanTimersAndReturnCount(_timers, eventIdentifiers);
return _timers.count;
}
eventIdentifiers:_DTXObjectReturningBlock(eventIdentifiers)
eventDescriptions:_DTXObjectReturningBlock(eventDescriptions)
Expand All @@ -142,11 +128,11 @@ - (void)trackTimerTrampoline:(_DTXTimerTrampoline *)trampoline
- (void)untrackTimerTrampoline:(_DTXTimerTrampoline *)trampoline
{
__block NSMutableArray<NSString*(^)(void)>* eventIdentifiers = [NSMutableArray new];

[self performMultipleUpdateBlock:^{
[eventIdentifiers addObject:_DTXStringReturningBlock([NSString stringWithFormat:@"%p", trampoline])];
[_timers removeObject:trampoline];
return _DTXCleanTimersAndReturnCount(_timers, eventIdentifiers);
return _timers.count;
} eventIdentifiers:_DTXObjectReturningBlock(eventIdentifiers)
eventDescriptions:nil
objectDescriptions:nil
Expand Down
28 changes: 14 additions & 14 deletions DetoxSync/DetoxSync/SyncResources/DTXUISyncResource.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,45 +113,45 @@ - (void)_untrackForParam:(NSUInteger*)param eventIdentifier:(NSString*(NS_NOESCA
- (void)trackViewNeedsLayout:(UIView *)view
{
NSString* identifier = [self _trackForParam:&_viewNeedsLayoutCount eventDescription:_DTXStringReturningBlock(@"View Layout") objectDescription:_DTXStringReturningBlock(view.__detox_sync_safeDescription)];

__detox_sync_orig_dispatch_async(dispatch_get_main_queue(), ^ {
[self _untrackForParam:&_viewNeedsLayoutCount eventIdentifier:_DTXStringReturningBlock(identifier)];
[self _untrackForParam:&self->_viewNeedsLayoutCount eventIdentifier:_DTXStringReturningBlock(identifier)];
Copy link
Contributor

@asafkorem asafkorem May 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

being explicit in such cases is indeed better

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but except for being more explicit, is there any other goal in this change? What exactly is the fix here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

});
}

- (void)trackViewNeedsDisplay:(UIView *)view
{
NSString* identifier = [self _trackForParam:&_viewNeedsDisplayCount eventDescription:_DTXStringReturningBlock(@"View Display") objectDescription:_DTXStringReturningBlock(view.__detox_sync_safeDescription)];

__detox_sync_orig_dispatch_async(dispatch_get_main_queue(), ^ {
[self _untrackForParam:&_viewNeedsDisplayCount eventIdentifier:_DTXStringReturningBlock(identifier)];
[self _untrackForParam:&self->_viewNeedsDisplayCount eventIdentifier:_DTXStringReturningBlock(identifier)];
});
}

- (void)trackLayerNeedsLayout:(CALayer *)layer
{
NSString* identifier = [self _trackForParam:&_layerNeedsLayoutCount eventDescription:_DTXStringReturningBlock(@"Layer Layout") objectDescription:_DTXStringReturningBlock(layer.description)];

__detox_sync_orig_dispatch_async(dispatch_get_main_queue(), ^ {
[self _untrackForParam:&_layerNeedsLayoutCount eventIdentifier:_DTXStringReturningBlock(identifier)];
[self _untrackForParam:&self->_layerNeedsLayoutCount eventIdentifier:_DTXStringReturningBlock(identifier)];
});
}

- (void)trackLayerNeedsDisplay:(CALayer *)layer
{
NSString* identifier = [self _trackForParam:&_layerNeedsDisplayCount eventDescription:_DTXStringReturningBlock(@"Layer Display") objectDescription:_DTXStringReturningBlock(layer.description)];

__detox_sync_orig_dispatch_async(dispatch_get_main_queue(), ^ {
[self _untrackForParam:&_layerNeedsDisplayCount eventIdentifier:_DTXStringReturningBlock(identifier)];
[self _untrackForParam:&self->_layerNeedsDisplayCount eventIdentifier:_DTXStringReturningBlock(identifier)];
});
}

- (void)trackLayerPendingAnimation:(CALayer*)layer
{
NSString* identifier = [self _trackForParam:&_layerPendingAnimationCount eventDescription:_DTXStringReturningBlock(@"Layer Pending Animation") objectDescription:_DTXStringReturningBlock(layer.description)];

__detox_sync_orig_dispatch_async(dispatch_get_main_queue(), ^ {
[self _untrackForParam:&_layerPendingAnimationCount eventIdentifier:_DTXStringReturningBlock(identifier)];
[self _untrackForParam:&self->_layerPendingAnimationCount eventIdentifier:_DTXStringReturningBlock(identifier)];
});
}

Expand All @@ -160,9 +160,9 @@ - (void)trackViewControllerWillAppear:(UIViewController *)vc
if(vc.transitionCoordinator)
{
NSString* identifier = [self _trackForParam:&_viewControllerWillAppearCount eventDescription:_DTXStringReturningBlock(@"View Layout") objectDescription:_DTXStringReturningBlock(vc.description)];

[vc.transitionCoordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
[self _untrackForParam:&_viewControllerWillAppearCount eventIdentifier:_DTXStringReturningBlock(identifier)];
[self _untrackForParam:&self->_viewControllerWillAppearCount eventIdentifier:_DTXStringReturningBlock(identifier)];
}];
}
}
Expand All @@ -172,9 +172,9 @@ - (void)trackViewControllerWillDisappear:(UIViewController *)vc
if(vc.transitionCoordinator)
{
NSString* identifier = [self _trackForParam:&_viewControllerWillDisappearCount eventDescription:_DTXStringReturningBlock(@"View Layout") objectDescription:_DTXStringReturningBlock(vc.description)];

[vc.transitionCoordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) {
[self _untrackForParam:&_viewControllerWillDisappearCount eventIdentifier:_DTXStringReturningBlock(identifier)];
[self _untrackForParam:&self->_viewControllerWillDisappearCount eventIdentifier:_DTXStringReturningBlock(identifier)];
}];
}
}
Expand Down
85 changes: 31 additions & 54 deletions DetoxSync/DetoxSync/Utils/_DTXTimerTrampoline.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ @implementation _DTXTimerTrampoline
{
id _target;
SEL _sel;
ball-hayden marked this conversation as resolved.
Show resolved Hide resolved

//NSTimer
__weak NSTimer* _timer;
CFRunLoopTimerCallBack _callback;
CFRunLoopRef _runLoop;
NSString* _timerDescription;
NSTimeInterval _timeUntilFire;

//CADisplayLink
__weak CADisplayLink* _displayLink;

BOOL _tracking;

#if DEBUG
NSString* _history;
#endif
Expand All @@ -53,7 +53,7 @@ - (instancetype)initWithTarget:(id)target selector:(SEL)selector fireDate:(NSDat
_timeUntilFire = [fireDate timeIntervalSinceNow];
_ti = ti;
_repeats = rep;

#if DEBUG
_history = [NSString stringWithFormat:@"%@\n%@", NSStringFromSelector(_cmd), NSThread.callStackSymbols];
#endif
Expand All @@ -71,7 +71,7 @@ - (instancetype)initWithCallback:(CFRunLoopTimerCallBack)callback fireDate:(NSDa
_timeUntilFire = [fireDate timeIntervalSinceNow];
_ti = ti;
_repeats = rep;

#if DEBUG
_history = [NSString stringWithFormat:@"%@\n%@", NSStringFromSelector(_cmd), NSThread.callStackSymbols];
#endif
Expand All @@ -86,8 +86,8 @@ - (BOOL)isDead

- (void)dealloc
{
[self untrack];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand properly, the only time we should be deallocing is when the Trampoline is removed from DTXTimerSyncResource _timers?

For us to have done that, we must have called untrack already.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's what I understand as well. I will revisit this and make sure that's indeed the case but generally I think you're right.

NSLog(@"🤦‍♂️ trampoline dealloc: %@ (tracking: %d)", self, _tracking);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I added this to verify the assumption above. I've not seen this called with tracking YES).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


objc_setAssociatedObject(_timer, __DTXTimerTrampolineKey, nil, OBJC_ASSOCIATION_RETAIN);
}

Expand All @@ -96,7 +96,7 @@ - (void)setTimer:(NSTimer*)timer
_timer = timer;
_timerDescription = [[timer debugDescription] copy];
objc_setAssociatedObject(timer, __DTXTimerTrampolineKey, self, OBJC_ASSOCIATION_RETAIN);

#if DEBUG
_history = [NSString stringWithFormat:@"%@\n%@", _history, [timer debugDescription]];
#endif
Expand All @@ -112,47 +112,24 @@ - (void)setDisplayLink:(CADisplayLink*)displayLink
#endif
}

- (void)fire:(id)timer
- (void)fire
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The following changes are a bit more involved.

Firstly, there's no need for the timer parameter - we already have a reference to that as an ivar.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can understand why the timer argument is redundant.

{
//This is to ensure the timer is still valid after fire.
CFRunLoopRef runloop = CFRunLoopGetCurrent();
CFRunLoopMode mode = CFRunLoopCopyCurrentMode(runloop);
CFRunLoopPerformBlock(runloop, mode, ^{
if(CFRunLoopTimerIsValid((__bridge CFRunLoopTimerRef)timer) == NO)
{
[self untrack];

CFRelease(mode);

return;
}

CFRunLoopPerformBlock(runloop, mode, ^{
if(CFRunLoopTimerIsValid((__bridge CFRunLoopTimerRef)timer) == NO)
{
[self untrack];

CFRelease(mode);

return;
}

CFRelease(mode);
});
});
Comment on lines -117 to -142
Copy link
Contributor Author

@ball-hayden ball-hayden Apr 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand right, the purpose of these are to see if the timer is still valid after it has fired.

If we ask if the timer is valid inline here, CFRunLoopTimerIsValid always evaluates to true, I assume because we're still within the fire function.

Here I'm proposing a different method.

We track the invalidation and removal of timers (in NSTimer+DTXSpy.m), which means we know when a repeating timer is stopping. We also know that a timer that doesn't repeat is finished once we have called its callback (or selector).

Therefore, we can simply call untrack if we are not a recurring timer after we have called its callback.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I understand, this code checks whether the timer needs to be untracked (for example, as you mentioned - in case of a non-repeating timer) immediately after finishing the fire.

Therefore, we can simply call untrack if we are not a recurring timer after we have called its callback.

Generally, this sounds right, but I'm not sure if recurring / non-recurring is our only flow. What about calling to CFRunLoopTimerInvalidate on the 3rd fire or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling CFRunLoopTimerInvalidate will result in an explicit call to untrack from the spy:

https://github.com/PlayerData/DetoxSync/blob/f5cd8cbde60311bb8e41df7c773850cd73c8f84b/DetoxSync/DetoxSync/Spies/NSTimer%2BDTXSpy.m#L108


if(_callback)
{
CFRunLoopTimerContext ctx;
CFRunLoopTimerGetContext((__bridge CFRunLoopTimerRef)timer, &ctx);
_callback((__bridge CFRunLoopTimerRef)timer, ctx.info);
return;
CFRunLoopTimerGetContext((__bridge CFRunLoopTimerRef)_timer, &ctx);
_callback((__bridge CFRunLoopTimerRef)_timer, ctx.info);
}

if(_target && _sel) {
IMP impl = [_target methodForSelector:_sel];
void (*func)(id, SEL, NSTimer*) = (void *)impl;
func(_target, _sel, _timer);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a small tidy-up recommended by https://stackoverflow.com/a/20058585

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


if(!_repeats) {
[self untrack];
}
Comment on lines +141 to 143
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this will have the same result as the previous check.


#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
[_target performSelector:_sel withObject:timer];
#pragma clang diagnostic pop
Comment on lines -152 to -155
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you removed this? I guess it was there for a reason

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is replaced by ln 131-138 - gaining a reference to impl explicitly is recommended.

I think my previous comment was lost - sorry.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't, you're right #33 (comment), forgot about this for a moment 😅

}

- (void)track
Expand All @@ -161,7 +138,7 @@ - (void)track
{
return;
}

_tracking = YES;
[DTXTimerSyncResource.sharedInstance trackTimerTrampoline:self];
}
Expand All @@ -172,9 +149,9 @@ - (void)untrack
{
return;
}

// NSLog(@"🤦‍♂️ untrack: %@", _timer);

[DTXTimerSyncResource.sharedInstance untrackTimerTrampoline:self];
_tracking = NO;
}
Expand All @@ -192,12 +169,12 @@ + (NSDateFormatter*)_descriptionDateFormatter
}

- (DTXBusyResource *)jsonDescription {
return @{
@"fire_date": _fireDate ? [_DTXTimerTrampoline._descriptionDateFormatter stringFromDate:_fireDate] : @"none",
@"time_until_fire": @(_timeUntilFire),
@"is_recurring": @(_repeats),
@"repeat_interval": @(_ti)
};
return @{
@"fire_date": _fireDate ? [_DTXTimerTrampoline._descriptionDateFormatter stringFromDate:_fireDate] : @"none",
@"time_until_fire": @(_timeUntilFire),
@"is_recurring": @(_repeats),
@"repeat_interval": @(_ti)
};
Comment on lines -195 to +188
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the file is indented using tabs. Fixed for consistency (and editor happiness).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Legit 👍
To be honest, I hate tabs, but I prefer consistency over inconsistency.

}

#if DEBUG
Expand Down