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

chore(redis): Make pipeline configurable #101

Merged
merged 1 commit into from
Jul 18, 2016
Merged

chore(redis): Make pipeline configurable #101

merged 1 commit into from
Jul 18, 2016

Conversation

krancour
Copy link
Contributor

At @jchauncey's suggestion, I am making Redis pipelines more configurable in terms of their length and in terms of how long we will queue up messages before executing a pipeline that has not yet reached the configured length. (This is to avoid a large delay in messages reaching Redis when log volumes are low.)

This PR does not change the default values.

@krancour krancour added this to the v2.2 milestone Jul 18, 2016
@krancour krancour self-assigned this Jul 18, 2016
@codecov-io
Copy link

codecov-io commented Jul 18, 2016

Current coverage is 41.48%

Merging #101 into master will increase coverage by 0.36%

@@             master       #101   diff @@
==========================================
  Files            10         10          
  Lines           321        323     +2   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            132        134     +2   
  Misses          169        169          
  Partials         20         20          

Powered by Codecov. Last updated by 25fb250...7bc332e

@@ -29,11 +29,11 @@ type messagePipeliner struct {
errCh chan error
}

func newMessagePipeliner(bufferSize int, redisClient *r.Client, errCh chan error) *messagePipeliner {
func newMessagePipeliner(bufferSize int, redisClient *r.Client, timeoutSeconds int, errCh chan error) *messagePipeliner {
Copy link
Member

Choose a reason for hiding this comment

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

can you just pass a time.Duration here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So... I did try having a time.Duration in the redisConfig type, but found that envconfig couldn't handle that. So, barring that, the only way to pass a time.Duration to this function would be for any caller to convert the int to a time.Duration before calling. Somehow I'm not sure if that's actually better, but I am certain I could be convinced.

Copy link
Member

Choose a reason for hiding this comment

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

yea, fair enough. I was suggesting converting it to a time.Duration at the config struct, and passing time.Durations down the stack from there. thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah. Yes... I can manually convert if in the parseConfig() function. I didn't think of that before.

@arschles
Copy link
Member

#101 (comment) is not blocking this PR. LGTM2

@krancour
Copy link
Contributor Author

@arschles I amended the PR as per your suggestion about passing around time.Durations instead of an integer representing seconds. Feel free to re-review.

DB int `envconfig:"DEIS_LOGGER_REDIS_DB" default:"0"`
PipelineLength int `envconfig:"DEIS_LOGGER_REDIS_PIPELINE_LENGTH" default:"50"`
PipelineTimeoutSeconds int `envconfig:"DEIS_LOGGER_REDIS_PIPELINE_TIMEOUT_SECONDS" default:"1"`
PipelineTimeout time.Duration
Copy link
Member

Choose a reason for hiding this comment

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

might want to leave this out of the struct and make it a function on the struct. past versions (at least) of envconfig would try to parse this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems to be ok with the current version. I'm going to leave it be for now.

@arschles
Copy link
Member

@krancour cool - still LGTM

@krancour krancour merged commit b3ae65e into deis:master Jul 18, 2016
@krancour krancour deleted the configurable-pipelines branch July 18, 2016 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants