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

feat(redis_client): add logging support #1270

Merged
merged 8 commits into from
Sep 15, 2023
Merged

Conversation

felangel
Copy link
Contributor

Description

  • feat(redis_client): add logging support
  • feat: improve reconnection and command retry logic and simplify API

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@felangel felangel self-assigned this Sep 15, 2023
@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (e957829) 98.95% compared to head (8ed1acb) 98.96%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1270   +/-   ##
=======================================
  Coverage   98.95%   98.96%           
=======================================
  Files         179      179           
  Lines        4703     4744   +41     
=======================================
+ Hits         4654     4695   +41     
  Misses         49       49           
Flag Coverage Δ
redis_client 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
packages/redis_client/lib/src/redis_client.dart 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


final finalValue = await client.get(key: key); // null
assert(finalValue == null, 'Key should not exist.');
// Send a command to the Redis server.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Simplified the example

Copy link
Contributor

@eseidel eseidel left a comment

Choose a reason for hiding this comment

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

I'm too tired to give you a useful review, but I'm very glad to see this coming together!

@@ -73,153 +141,169 @@ class RedisClient {
/// A completer which completes when the client establishes a connection.
var _connected = Completer<void>();

/// Whether the client is connected.
var _isConnected = false;

/// A completer which completes when the client disconnects.
/// Begins in a completed state since the client is initially disconnected.
var _disconnected = Completer<void>()..complete();
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought member variables were typically declared with types in Dart?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The lint rules we have consistently enforce omitting types if they can be inferred.

Copy link
Contributor

@bryanoltman bryanoltman left a comment

Choose a reason for hiding this comment

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

A few small comments, but mostly looks good. I definitely think this could be its own package. Maybe dart_redis or something so people don't think it's related to code push in some way?

]);
if (result is RespBulkString) {
final parts = LineSplitter.split(result.payload ?? '');
final result = await _client.execute(['JSON.GET', key, r'$']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on extracting these json method names to consts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They should only be used in this one spot so I didn't see as much value but happy to do so if you prefer.

packages/redis_client/lib/src/redis_client.dart Outdated Show resolved Hide resolved
final finalValue = await client.get(key: key); // null
assert(finalValue == null, 'Key should not exist.');
// Execute a command.
await client.execute(['PING']); // PONG

Copy link
Contributor

Choose a reason for hiding this comment

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

Why get rid of the get/set/delete examples?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just thought the simplest getting started would be best but happy to change it back 🤷

@felangel felangel merged commit b422593 into main Sep 15, 2023
@felangel felangel deleted the feat/redis-client-logging branch September 15, 2023 16:32
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.

3 participants