Cannot set mirror interval to less than 10 minutes #3086

Closed
opened 2025-11-02 05:00:21 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @ghost on GitHub (Mar 20, 2019).

  • Gitea version (or commit ref): f7f2f12 built with go1.12.1

  • Git version: 2.20.1

  • Operating system: official docker container

  • Database (use [x]):

    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:

    • Yes (provide example URL)
    • No
    • Not relevant

https://try.gitea.io/sn0w/drone-mirror/

  • Log gist:
server_1  | [Macaron] 2019-03-20 15:30:38: Started POST /mirror/Discord.Net/settings for 94.221.113.111
server_1  | 2019/03/20 15:30:38 http: superfluous response.WriteHeader call from code.gitea.io/gitea/vendor/gopkg.in/macaron%2ev1.(*responseWriter).WriteHeader (response_writer.go:59)
server_1  | [Macaron] 2019-03-20 15:30:38: Completed POST /mirror/Discord.Net/settings 302 Found in 69.930428ms

Description

Setting the mirror interval to anything shorter than 10 minutes does not work.
Eg 9m59s and 5m0s both fail while 10m0s and anything longer works just fine.

Additionally, the wrong form field is highlighted (name instead of interval, see screenshot).

Screenshots

2019-03-20_16-33

Originally created by @ghost on GitHub (Mar 20, 2019). - Gitea version (or commit ref): f7f2f12 built with go1.12.1 - Git version: 2.20.1 - Operating system: official docker container - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - [ ] No - [ ] Not relevant https://try.gitea.io/sn0w/drone-mirror/ - Log gist: ``` server_1 | [Macaron] 2019-03-20 15:30:38: Started POST /mirror/Discord.Net/settings for 94.221.113.111 server_1 | 2019/03/20 15:30:38 http: superfluous response.WriteHeader call from code.gitea.io/gitea/vendor/gopkg.in/macaron%2ev1.(*responseWriter).WriteHeader (response_writer.go:59) server_1 | [Macaron] 2019-03-20 15:30:38: Completed POST /mirror/Discord.Net/settings 302 Found in 69.930428ms ``` ## Description Setting the mirror interval to anything shorter than 10 minutes does not work. Eg `9m59s` and `5m0s` both fail while `10m0s` and anything longer works just fine. Additionally, the wrong form field is highlighted (name instead of interval, see screenshot). ## Screenshots ![2019-03-20_16-33](https://user-images.githubusercontent.com/5665732/54697470-ec34b700-4b2d-11e9-91c4-db756901dbd8.png)
GiteaMirror added the topic/ui label 2025-11-02 05:00:21 -06:00
Author
Owner

@aswild commented on GitHub (Mar 23, 2019):

app.ini can set a minimum mirror sync interval, which defaults to 10m (MIN_INTERVAL in [mirror] section), so that part is working as designed. Not sure about the wrong input field being highlighted on the error page.

@aswild commented on GitHub (Mar 23, 2019): app.ini can set a minimum mirror sync interval, which defaults to 10m (MIN_INTERVAL in [mirror] section), so that part is working as designed. Not sure about the wrong input field being highlighted on the error page.
Author
Owner

@aswild commented on GitHub (Mar 23, 2019):

OK, I figured it out, will send a PR after I get my fix cleaned up and tested.

  • The mirror interval box isn't highlighted red because SettingsPost doesn't set ctx.Data["Err_Interval"] when the sync interval is invalid.
  • The repo name is highlighted red because the POST request with action=mirror doesn't set the repo_name parameter
  • ctx.Data["Err_RepoName"] gets set by auth.validate() because RepoName is required in RepoSettingForm but when POSTing the mirror settings form, the repo name doesn't get set (it's known from the URL anyway)

There's two possible fixes that I can think of: either don't make RepoName a required field of RepoSettingForm (and fix the update action handler accordingly), or add a hidden repo_name input field on all the other forms on the repo settings page. @lunny @lafriks @techknowlogick do the maintainers have a preference or third option for how to handle this?

@aswild commented on GitHub (Mar 23, 2019): OK, I figured it out, will send a PR after I get my fix cleaned up and tested. * The mirror interval box isn't highlighted red because `SettingsPost` doesn't set `ctx.Data["Err_Interval"]` when the sync interval is invalid. * The repo name is highlighted red because the POST request with action=mirror doesn't set the repo_name parameter * `ctx.Data["Err_RepoName"]` gets set by `auth.validate()` because `RepoName` is required in `RepoSettingForm` but when POSTing the mirror settings form, the repo name doesn't get set (it's known from the URL anyway) There's two possible fixes that I can think of: either don't make RepoName a required field of `RepoSettingForm` (and fix the `update` action handler accordingly), or add a hidden `repo_name` input field on all the other forms on the repo settings page. @lunny @lafriks @techknowlogick do the maintainers have a preference or third option for how to handle this?
Author
Owner

@ghost commented on GitHub (Mar 23, 2019):

app.ini can set a minimum mirror sync interval, which defaults to 10m (MIN_INTERVAL in [mirror] section), so that part is working as designed

Whoops, sorry.
Seems like I somehow overlooked that section in the sample config.

@ghost commented on GitHub (Mar 23, 2019): > app.ini can set a minimum mirror sync interval, which defaults to 10m (MIN_INTERVAL in [mirror] section), so that part is working as designed Whoops, sorry. Seems like I somehow overlooked that section in the sample config.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3086