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

URLEncodedForm date encoding strategy #2273

Merged

Conversation

thecheatah
Copy link
Contributor

@thecheatah thecheatah commented Mar 29, 2020

Adds ability to configure the date encoding and decoding strategy for the URLEncodedFormDecoder and URLEncodedFormEncoder (#2273).

import NIO

fileprivate final class ISO8601 {
fileprivate static let thread: ThreadSpecificVariable<ISO8601DateFormatter> = .init()
Copy link
Member

Choose a reason for hiding this comment

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

Isn't ISO8601DateFormatter thread safe itself? Making sure

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure. I found some discussion online that indicated otherwise. I can take this change back if you know or if we can confirm that ISO8601DateFormatter in Linux is thread safe.

I had found the following issue, but it seems like it's no longer reproducible (I didn't test myself): https://bugs.swift.org/browse/SR-7745?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

I didn't want to introduce something last minute with a threading issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Joannis I tried the attached project with 10000000 iterations on vapor/swift:5.2 docker image and didn't run into an issue. I will undo the multithreading.

Copy link
Member

Choose a reason for hiding this comment

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

@Joannis
Copy link
Member

Joannis commented Mar 31, 2020

Do you need another review? Or are there more changes incoming?

@thecheatah
Copy link
Contributor Author

thecheatah commented Mar 31, 2020

@Joannis, I spoke with Tanner about defaulting Vapor V4's date decoding to the Apple specific timestamp and he recommended that I submit a PR to default to the Unix Timestamp. That PR has been pulled into the release candidate. This change now introduces the ability to make additional customizations. Hope that background makes sense.

I think I am done with the changes. Let me know your thoughts. Tanner had planned to merge this request in after release.

@tanner0101 tanner0101 added the enhancement New feature or request label Mar 31, 2020
@tanner0101 tanner0101 added this to Awaiting Review in Vapor 4 via automation Mar 31, 2020
@thecheatah thecheatah requested a review from Joannis April 11, 2020 04:27
Copy link
Member

@tanner0101 tanner0101 left a comment

Choose a reason for hiding this comment

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

+1 to adding this, thanks!

@tanner0101 tanner0101 added the semver-minor Contains new API label Apr 14, 2020
@tanner0101 tanner0101 moved this from Awaiting Review to Awaiting Updates in Vapor 4 Apr 14, 2020
Vapor 4 automation moved this from Awaiting Updates to Awaiting Review Apr 21, 2020
Copy link
Member

@tanner0101 tanner0101 left a comment

Choose a reason for hiding this comment

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

👍 to the latest changes. Just one comment left. Thank you!

Copy link
Member

@tanner0101 tanner0101 left a comment

Choose a reason for hiding this comment

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

Looks great, thank you! Would you mind updating the PR body with release notes? You can see examples here: https://github.com/vapor/vapor/releases
A new release will be created automatically upon merging.

@tanner0101 tanner0101 moved this from Awaiting Review to Awaiting Updates in Vapor 4 Apr 21, 2020
@tanner0101 tanner0101 changed the title Added ability to configure date coding/decoding for UrlEncodedForm URLEncodedForm date encoding strategy Apr 21, 2020
@tanner0101 tanner0101 merged commit 7f6c827 into vapor:master Apr 21, 2020
Vapor 4 automation moved this from Awaiting Updates to Done Apr 21, 2020
@tanner0101
Copy link
Member

DigitalOcean and release bot are down atm. I've manually tagged this here: https://github.com/vapor/vapor/releases/tag/4.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request semver-minor Contains new API
Projects
Vapor 4
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants