Skip to content

Making refresh rate controllable from CLI#30

Open
aodhan-domhnaill wants to merge 2 commits intomainfrom
29-sleep-rate
Open

Making refresh rate controllable from CLI#30
aodhan-domhnaill wants to merge 2 commits intomainfrom
29-sleep-rate

Conversation

@aodhan-domhnaill
Copy link
Copy Markdown

Per #29

@aodhan-domhnaill aodhan-domhnaill requested a review from njogz August 12, 2021 12:13
Copy link
Copy Markdown
Contributor

@njogz njogz 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.

.option('--changes-limit [value]', 'number of changes to batch')
.option('--postgres-table [value]', 'name of the postgres table to replicate to')
.option('-d, --daemon', 'continually replicate between CouchDB and PostgresSQL')
.option('-s, --sleep', 'Sleep interval in milliseconds between runs in daemon mode (default 10 * 60 * 60 * 1000 [ms] = 10 hrs)')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we come up with a better name for this parameter? I'm thinking --sleep-interval or --polling-interval or something more descriptive?

Secondly, commander allows setting defaults which would save a little code later on, eg:

Suggested change
.option('-s, --sleep', 'Sleep interval in milliseconds between runs in daemon mode (default 10 * 60 * 60 * 1000 [ms] = 10 hrs)')
.option('-s, --sleep', 'Sleep interval in milliseconds between runs in daemon mode', 10 * 60 * 60 * 1000)

There are even more complicated options if you want to parse the variable or provide a human readable default value. More info in their documentation.

Copy link
Copy Markdown
Contributor

@garethbowen garethbowen left a comment

Choose a reason for hiding this comment

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

Nice addition! I've left a comment inline about parameter naming and using more advanced features of commander.

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