Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save jacobsapps/a905beaeed31514bf3c8c1bb23afee97 to your computer and use it in GitHub Desktop.

Select an option

Save jacobsapps/a905beaeed31514bf3c8c1bb23afee97 to your computer and use it in GitHub Desktop.
func postTweet(
text: String,
strategy _: RetryStrategy,
retryOptions _: RetryOptions
) async throws {
await engine.enqueue(text: text)
}
func enqueue(text: String) async {
let context = ModelContext(container)
let job = PersistedUploadJob(text: text, state: .pending)
context.insert(job)
do {
try context.save()
} catch {
print("Failed to persist job: \(error.localizedDescription)")
}
await processQueueIfNeeded()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment