Skip to content

Conversation

@jrodewig
Copy link
Contributor

@jrodewig jrodewig commented Aug 15, 2019

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-docs

@jrodewig
Copy link
Contributor Author

@elasticmachine run elasticsearch-ci/2

@hub-cap hub-cap self-requested a review August 15, 2019 15:28
Copy link
Contributor

@szabosteve szabosteve left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Contributor

@hub-cap hub-cap left a comment

Choose a reason for hiding this comment

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

other than changing the wording on the overrides, this is LGTM.

for this is 5 seconds. This default can be changed in the
config file with the setting `xpack.watcher.throttle.period.default_period`.
config file with the setting
`xpack.watcher.throttle.period.default_period`. If
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey i did a quick eyeball of the code here and it looks like this is not correct. The code is basically "last one wins" due to the for loop + non final variable assignment when parsing the watch.

So if you have

"throttle_period_in_millis": "7000",
"throttle_period": "5s",

the GET watch API returns throttle_period_in_millis":5000,

and if you have the opposite,

"throttle_period": "5s",
"throttle_period_in_millis": "7000",

the GET watch API returns throttle_period_in_millis":7000,

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tricky! I did look at that code, but I incorrectly assumed the first matching else if would win.

I reversed the override statements with cfe41d9.

Thanks for catching this @hub-cap.

Copy link
Contributor

Choose a reason for hiding this comment

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

So its not about one overriding the other, its about which one is declared first in the watch. if you declare both, the last one overrides the first one, so you can see in the example above that when i declared them both, which i did in 2 watches, the output was different based on which order they were declared in.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦‍♂ Sorry about that. Guess I'm feeling dense today.

Corrected again with deaef45.


| `throttle_period_in_millis` | Minimum time in milliseconds between actions
being run. Defaults to `5000`. If provided, this
value overrides the `throttle_period` value.
Copy link
Contributor

Choose a reason for hiding this comment

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

same here WRT the overrides.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed with cfe41d9.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Corrected again with deaef45.

Copy link
Contributor

Choose a reason for hiding this comment

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

💥

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.

[DOCS] Add examples in watchers definitions that uses throttle_period_in_millis

5 participants