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

Find exact match on ensure monitor #17

Open
jkotiuk opened this issue Mar 19, 2020 · 1 comment
Open

Find exact match on ensure monitor #17

jkotiuk opened this issue Mar 19, 2020 · 1 comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jkotiuk
Copy link

jkotiuk commented Mar 19, 2020

Hey,

I've had an issue when trying to add new monitor via EnsureMonitor method.
If the monitor for static page exists, lets say "example.com/static_page" and I wanted to add monitor for "example.com", it would not be added. EnsureMonitor would return ID of the static_page instead of creating new one.

@bitfield
Copy link
Owner

Hi @jkotiuk, thanks for opening the issue!

EnsureMonitor is currently implemented in a very simple-minded way; it just uses SearchMonitors to find all monitors whose URL or friendly name matches the supplied string. If there are any results, it doesn't add the new monitor.

So we need to be a bit cleverer here, don't we? One way would be to look at the results from SearchMonitors and see if any of them have the exact URL supplied. If not, create the monitor.

If you're interested in contributing a PR for this, please do! Otherwise this would be a nice issue for anybody who wants to contribute, to pick up.

@bitfield bitfield added good first issue Good for newcomers help wanted Extra attention is needed labels Mar 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants