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

[Bugfix] Allow resetting rate limit sleep interval #570

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/pinchflat/settings/setting.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ defmodule Pinchflat.Settings.Setting do
setting
|> cast(attrs, @allowed_fields)
|> validate_required(@required_fields)
|> validate_number(:extractor_sleep_interval_seconds, greater_than: 0)
|> validate_number(:extractor_sleep_interval_seconds, greater_than_or_equal_to: 0)
end
end
7 changes: 7 additions & 0 deletions test/pinchflat/settings_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,12 @@ defmodule Pinchflat.SettingsTest do
assert %Ecto.Changeset{valid?: true} = Settings.change_setting(setting, %{extractor_sleep_interval_seconds: 0})
assert %Ecto.Changeset{valid?: false} = Settings.change_setting(setting, %{extractor_sleep_interval_seconds: -1})
end

test "allows you to reset the extractor sleep interval" do
setting = Settings.record()
assert {:ok, setting} = Settings.update_setting(setting, %{extractor_sleep_interval_seconds: 1})

assert %Ecto.Changeset{valid?: true} = Settings.change_setting(setting, %{extractor_sleep_interval_seconds: 0})
end
end
end
Loading