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

refactor(storage): stop extending stdlib hash #66

Merged
merged 6 commits into from
Apr 29, 2021
Merged

Conversation

caspiano
Copy link
Contributor

@caspiano caspiano commented Apr 28, 2021

Extending stdlib interfaces is generally frowned upon by the crystal community.
In this case, this PR is a step towards unblocking sentry integration.

Includes a small optimisation to RedisStorage#to_h

See PlaceOS/rest-api/pull/89 and the referenced Raven.cr issue

@caspiano caspiano requested a review from stakach April 28, 2021 07:14
@caspiano caspiano added the type: enhancement new feature or request label Apr 28, 2021
@caspiano caspiano force-pushed the refactor/mixin-hash branch from bad0314 to 42b35ad Compare April 28, 2021 07:16
@caspiano caspiano self-assigned this Apr 28, 2021
Copy link
Member

@stakach stakach left a comment

Choose a reason for hiding this comment

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

LGTM

@caspiano
Copy link
Contributor Author

caspiano commented Apr 28, 2021

Specs aren't looking so hot in CI, I'll investigate

@caspiano caspiano force-pushed the refactor/mixin-hash branch from 42b35ad to 82d07a7 Compare April 29, 2021 02:19
@caspiano caspiano requested review from stakach and kimburgess April 29, 2021 02:33
src/placeos-driver/status.cr Outdated Show resolved Hide resolved
src/placeos-driver/storage.cr Outdated Show resolved Hide resolved
src/placeos-driver/storage/edge-storage.cr Outdated Show resolved Hide resolved
src/placeos-driver/storage/edge-storage.cr Show resolved Hide resolved
src/placeos-driver/storage/redis-storage.cr Outdated Show resolved Hide resolved
src/placeos-driver/storage/redis-storage.cr Outdated Show resolved Hide resolved
src/placeos-driver/storage/redis-storage.cr Outdated Show resolved Hide resolved
@caspiano caspiano requested a review from kimburgess April 29, 2021 05:28
@stakach
Copy link
Member

stakach commented Apr 29, 2021

Following up on the comments by Kim, the hash should be storing JSON strings.
So an empty string is "\"\"" in JSON and won't be effected by .presence but nil.to_s is actually in empty string an we don't want that value

@caspiano caspiano merged commit 9ef2c09 into master Apr 29, 2021
@caspiano caspiano deleted the refactor/mixin-hash branch April 29, 2021 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement new feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants