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

RUMM-2171 Single Storage Queue #874

Merged
merged 2 commits into from
Jun 1, 2022

Conversation

maxep
Copy link
Member

@maxep maxep commented May 31, 2022

What and why?

Use single storage queue.

Review checklist

  • Feature or bugfix MUST have appropriate tests (unit, integration)
  • Make sure each commit and the PR mention the Issue number or JIRA reference
  • Add CHANGELOG entry for user facing changes

Custom CI job configuration (optional)

  • Run unit tests
  • Run integration tests
  • Run smoke tests

@maxep maxep requested a review from a team as a code owner May 31, 2022 13:49
@maxep maxep self-assigned this May 31, 2022
@maxep maxep force-pushed the maxep/RUMM-2171/single-storage-queue branch from e3c1032 to 94819c0 Compare May 31, 2022 14:30
Copy link
Member

@ncreated ncreated left a comment

Choose a reason for hiding this comment

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

Looks good 👌💯. I left one feedback on potential small improvement in tests.

Comment on lines +48 to +51
let readWriteQueue = DispatchQueue(
label: "com.datadoghq.ios-sdk-read-write",
target: .global(qos: .utility)
)
Copy link
Member

Choose a reason for hiding this comment

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

There is one potential step we could look into in this PR. Now, by having an explicit access to this r/w queue we can simplify this test:

// On SDK init, underlying `ConsentAwareDataWriter` performs data migration for each feature, which includes
// data removal in `unauthorised` (`.pending`) directory. To not cause test flakiness, we must ensure that
// mock data is written only after this operation completes - otherwise, migration may delete mocked files.
let loggingWriter = try XCTUnwrap(logging?.storage.writer as? ConsentAwareDataWriter)
let tracingWriter = try XCTUnwrap(tracing?.storage.writer as? ConsentAwareDataWriter)
let rumWriter = try XCTUnwrap(rum?.storage.writer as? ConsentAwareDataWriter)
loggingWriter.queue.sync {}
tracingWriter.queue.sync {}
rumWriter.queue.sync {}

We .sync {} on each Feature's queue, but now it can be single core.readWriteQueue.sync {}.

Copy link
Member Author

@maxep maxep Jun 1, 2022

Choose a reason for hiding this comment

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

Good catch!

@maxep maxep merged commit 281d16e into feature/v2 Jun 1, 2022
@maxep maxep deleted the maxep/RUMM-2171/single-storage-queue branch June 1, 2022 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants