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

fix: change storage to use sync queue, fix retry issues #14

Merged
merged 1 commit into from
Dec 7, 2022

Conversation

liuyang1520
Copy link
Collaborator

Summary

  • fix: change storage to use sync queue
  • fix: retry issues

When multiple Task are created, the order of execution doesn't seem to be guaranteed: https://forums.swift.org/t/task-is-order-of-task-execution-deterministic/51553/30, namely FIFO.

After some investigation, I think @globalActor might be a potential solution. However, as the documentation is limited, and I don't have a good example to verify it. I change the storage to use dispatch queue (old generation API). Example I tried with @globalActor:

...
    @SomeGlobalActor
    func test_mainActor_taskOrdering() async {
        var counter = 0
        var tasks = [Task<Void, Never>]()
        for iteration in 1...1000 {
            tasks.append(Task {
                print(Thread.current)
                counter += 1
                XCTAssertEqual(counter, iteration) // often fails
            })
        }
        
        for task in tasks {
            _ = await task.value
        }
    }
...

@globalActor
public struct SomeGlobalActor {
  public actor MyActor { }

  public static let shared = MyActor()
}

Also test the error cases for handlers, found minor issues and fix here.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?:

@liuyang1520 liuyang1520 merged commit e2d824a into main Dec 7, 2022
github-actions bot pushed a commit that referenced this pull request Dec 15, 2022
# 1.0.0 (2022-12-15)

### Bug Fixes

* add lifecycle plugin ([a26c621](a26c621))
* add other platform lifecycle plugin and lints fix ([c3f9c5b](c3f9c5b))
* add return to IdentityEventSender.execute ([75d787e](75d787e))
* add the placeholder for IdentityEventSender ([2ad97da](2ad97da))
* change storage to use sync queue, fix retry issues ([#14](#14)) ([e2d824a](e2d824a))
* fix based on comments ([4f354bc](4f354bc))
* fix logger in destination ([a7ff24e](a7ff24e))
* fix the demo app to fit ipad ([#12](#12)) ([72b1ef1](72b1ef1))
* fix timeline in destination plugin ([0767751](0767751))
* lints and other comments ([296951b](296951b))
* nits ([2e264a5](2e264a5))
* pass amplitude instance in plugin setup ([42fbb51](42fbb51))
* typo and types ([fe5dba7](fe5dba7))
* update support watchOS version ([5cc61f2](5cc61f2))

### Features

* add class and file placeholders ([d824cf1](d824cf1))
* add podspec and release flow ([#18](#18)) ([ef1ff28](ef1ff28))
* add timeline ([7cda5b2](7cda5b2))
* Context plugin ([#8](#8)) ([64ba783](64ba783))
* destination plugin ([4dc18d9](4dc18d9))
* identify, revenue, amplitude client ([#16](#16)) ([ab847f0](ab847f0))
* idfa plugin example ([#17](#17)) ([9104e5f](9104e5f))
* main function implementation ([29645c0](29645c0))
* persistent storage, httpclient, eventpipeline ([#9](#9)) ([0b5e99f](0b5e99f))
* response retry handlers ([#11](#11)) ([86d92f6](86d92f6))
* session event init ([#13](#13)) ([bbf7517](bbf7517))
* setup lint, jira issue create, fix all file lint issues, update config ([0a34b96](0a34b96))
* support event callback and fix missing insert_id ([#15](#15)) ([1f746e8](1f746e8))
github-actions bot pushed a commit that referenced this pull request Dec 15, 2022
# 1.0.0 (2022-12-15)

### Bug Fixes

* add lifecycle plugin ([a26c621](a26c621))
* add other platform lifecycle plugin and lints fix ([c3f9c5b](c3f9c5b))
* add return to IdentityEventSender.execute ([75d787e](75d787e))
* add the placeholder for IdentityEventSender ([2ad97da](2ad97da))
* change storage to use sync queue, fix retry issues ([#14](#14)) ([e2d824a](e2d824a))
* fix based on comments ([4f354bc](4f354bc))
* fix logger in destination ([a7ff24e](a7ff24e))
* fix the demo app to fit ipad ([#12](#12)) ([72b1ef1](72b1ef1))
* fix timeline in destination plugin ([0767751](0767751))
* lints and other comments ([296951b](296951b))
* nits ([2e264a5](2e264a5))
* pass amplitude instance in plugin setup ([42fbb51](42fbb51))
* typo and types ([fe5dba7](fe5dba7))
* update support watchOS version ([5cc61f2](5cc61f2))

### Features

* add class and file placeholders ([d824cf1](d824cf1))
* add podspec and release flow ([#18](#18)) ([ef1ff28](ef1ff28))
* add timeline ([7cda5b2](7cda5b2))
* Context plugin ([#8](#8)) ([64ba783](64ba783))
* destination plugin ([4dc18d9](4dc18d9))
* identify, revenue, amplitude client ([#16](#16)) ([ab847f0](ab847f0))
* idfa plugin example ([#17](#17)) ([9104e5f](9104e5f))
* main function implementation ([29645c0](29645c0))
* persistent storage, httpclient, eventpipeline ([#9](#9)) ([0b5e99f](0b5e99f))
* response retry handlers ([#11](#11)) ([86d92f6](86d92f6))
* session event init ([#13](#13)) ([bbf7517](bbf7517))
* setup lint, jira issue create, fix all file lint issues, update config ([0a34b96](0a34b96))
* support event callback and fix missing insert_id ([#15](#15)) ([1f746e8](1f746e8))
@github-actions
Copy link

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

github-actions bot pushed a commit that referenced this pull request Dec 15, 2022
# [0.1.0](v0.0.0...v0.1.0) (2022-12-15)

### Bug Fixes

* add lifecycle plugin ([a26c621](a26c621))
* add other platform lifecycle plugin and lints fix ([c3f9c5b](c3f9c5b))
* add return to IdentityEventSender.execute ([75d787e](75d787e))
* add the placeholder for IdentityEventSender ([2ad97da](2ad97da))
* change storage to use sync queue, fix retry issues ([#14](#14)) ([e2d824a](e2d824a))
* fix based on comments ([4f354bc](4f354bc))
* fix logger in destination ([a7ff24e](a7ff24e))
* fix the demo app to fit ipad ([#12](#12)) ([72b1ef1](72b1ef1))
* fix timeline in destination plugin ([0767751](0767751))
* lints and other comments ([296951b](296951b))
* nits ([2e264a5](2e264a5))
* pass amplitude instance in plugin setup ([42fbb51](42fbb51))
* typo and types ([fe5dba7](fe5dba7))
* update support watchOS version ([5cc61f2](5cc61f2))

### Features

* add class and file placeholders ([d824cf1](d824cf1))
* add podspec and release flow ([#18](#18)) ([ef1ff28](ef1ff28))
* add timeline ([7cda5b2](7cda5b2))
* Context plugin ([#8](#8)) ([64ba783](64ba783))
* destination plugin ([4dc18d9](4dc18d9))
* identify, revenue, amplitude client ([#16](#16)) ([ab847f0](ab847f0))
* idfa plugin example ([#17](#17)) ([9104e5f](9104e5f))
* main function implementation ([29645c0](29645c0))
* persistent storage, httpclient, eventpipeline ([#9](#9)) ([0b5e99f](0b5e99f))
* response retry handlers ([#11](#11)) ([86d92f6](86d92f6))
* session event init ([#13](#13)) ([bbf7517](bbf7517))
* setup lint, jira issue create, fix all file lint issues, update config ([0a34b96](0a34b96))
* support event callback and fix missing insert_id ([#15](#15)) ([1f746e8](1f746e8))
@justin-fiedler justin-fiedler deleted the fix-retry-storage branch September 28, 2023 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants