update critical path to be more async #118
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements to the
ConfigurationManager
andDeviceIdGenerator
classes, focusing on optimizing asynchronous operations, enhancing thread safety, and improving initialization performance. Additionally, it updates theclerk-sdk
library version and enables code minification for release builds. Below is a categorized summary of the most important changes.Build Configuration Updates:
clerk-sdk
library version from0.1.1
to0.1.2
ingradle/libs.versions.toml
.source/build.gradle.kts
by settingisMinifyEnabled
totrue
.Asynchronous Initialization Enhancements:
ConfigurationManager
initialization by moving storage setup, device ID generation, and lifecycle monitoring to background tasks usingasync
blocks. This avoids blocking the main thread and improves startup performance. [1] [2]async
) for fetching tokens, ensuring the refresh loop remains non-blocking.Device Attestation Improvements:
ConfigurationManager
to run independently in background tasks usingasync
for better isolation and concurrency. Added retry logic with exponential backoff for failed attestation attempts. [1] [2] [3]Device ID Generation Enhancements:
DeviceIdGenerator
to prioritize loading existing device IDs from storage before generating new ones. Improved thread safety with double-checked locking and added asynchronous persistence for new IDs. [1] [2]Logging and Error Handling:
ConfigurationManager
andDeviceIdGenerator
to provide more detailed insights into initialization, attestation, and token refresh processes. Enhanced error handling to ensure background operations fail gracefully without blocking critical workflows. [1] [2]