Skip to content

Commit

Permalink
docs(janitor): add info on limit and batch deletes
Browse files Browse the repository at this point in the history
  • Loading branch information
flavioleggio committed May 21, 2021
1 parent d55622b commit 86bda51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cmd/janitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ func NewJanitorCmd() *cobra.Command {
Use: "janitor [<database-url>]",
Short: "Clean the database of old tokens and login/consent requests",
Long: `This command will cleanup any expired oauth2 tokens as well as login/consent requests.
This will select records to delete with a limit and delete records in batch to ensure that no table locking issues arise in big production databases.
### Warning ###
Expand Down Expand Up @@ -52,8 +53,8 @@ Janitor can be used in several ways.
RunE: cli.NewHandler().Janitor.RunE,
Args: cli.NewHandler().Janitor.Args,
}
cmd.Flags().Int(cli.Limit, 10000, "Limits the number of records retrieved from database for deletion.")
cmd.Flags().Int(cli.BatchSize, 100, "Limits the number of records retrieved from database for deletion.")
cmd.Flags().Int(cli.Limit, 10000, "Limit the number of records retrieved from database for deletion.")
cmd.Flags().Int(cli.BatchSize, 100, "Define how many records are deleted with each iteration.")
cmd.Flags().Duration(cli.KeepIfYounger, 0, "Keep database records that are younger than a specified duration e.g. 1s, 1m, 1h.")
cmd.Flags().Duration(cli.AccessLifespan, 0, "Set the access token lifespan e.g. 1s, 1m, 1h.")
cmd.Flags().Duration(cli.RefreshLifespan, 0, "Set the refresh token lifespan e.g. 1s, 1m, 1h.")
Expand Down
4 changes: 4 additions & 0 deletions docs/docs/cli/hydra-janitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Clean the database of old tokens and login/consent requests

This command will cleanup any expired oauth2 tokens as well as login/consent
requests.
This will select records to delete with a limit and delete records in batch
to ensure that no table locking issues arise in big production databases.

### Warning

Expand Down Expand Up @@ -69,6 +71,8 @@ hydra janitor [&lt;database-url&gt;] [flags]
-c, --config strings Path to one or more .json, .yaml, .yml, .toml config files. Values are loaded in the order provided, meaning that the last config file overwrites values from the previous config file.
--consent-request-lifespan duration Set the login/consent request lifespan e.g. 1s, 1m, 1h
-h, --help help for janitor
--limit Limits the number of records retrieved from database for deletion. This is optional and default value is 10000 records.
--batch-size Define how many records are deleted with each iteration. This is optional and default value is 100 records.
--keep-if-younger duration Keep database records that are younger than a specified duration e.g. 1s, 1m, 1h.
-e, --read-from-env If set, reads the database connection string from the environment variable DSN or config file key dsn.
--refresh-lifespan duration Set the refresh token lifespan e.g. 1s, 1m, 1h.
Expand Down

0 comments on commit 86bda51

Please sign in to comment.