Skip to content
Open
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,17 @@ final class MeteringTask {
logger.info(
"All metering operations have been settled for at least \(self.minStableFocusDurationUntilResolve) seconds - completed!"
)
onComplete?()
isFinished = true
destroy()

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If we add a debug only assert to update() to ensure it is only ever called from the same queue via Dispatch Specific, then we can move these two lines down just above onComplete?() (line 170 now) again to make the code easier to read? not sure if needed 100% tbh, but it felt weird to see isFinished = true, and then some more actual logic (switch adaptivenes { ...}) after that - reads like it isn't finished after all or has an intermediate state then.

// After completion, update AE/AF/AWB to locked or continuous tracking
// Update AE/AF/AWB to locked or continuous tracking *before* resolving,
// so callers observe the final modes as soon as the Promise resolves.
Comment on lines +162 to +163

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
// Update AE/AF/AWB to locked or continuous tracking *before* resolving,
// so callers observe the final modes as soon as the Promise resolves.
// Update AE/AF/AWB to locked or continuous tracking to complete the metering task

switch adaptiveness {
case .continuous:
try? setMeteringValuesToContinuous()
case .locked:
try? setMeteringValuesToLocked()
}
onComplete?()
// Start the timer for auto reset (if enabled)
if case .after(let seconds) = self.autoReset {
self.queue.asyncAfter(deadline: .now() + seconds) { [weak self] in
Expand Down
Loading