mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(feed): Configurable request timeout (#456)
* feat(feed): Add field for setting request timeout * fix: missing type in interface * feat: add postgres migration and column to base schema
This commit is contained in:
parent
47eaeaa635
commit
72be86a34f
10 changed files with 42 additions and 14 deletions
|
@ -34,6 +34,7 @@ func (r *FeedRepo) FindByID(ctx context.Context, id int) (*domain.Feed, error) {
|
|||
"enabled",
|
||||
"url",
|
||||
"interval",
|
||||
"timeout",
|
||||
"api_key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
|
@ -55,7 +56,7 @@ func (r *FeedRepo) FindByID(ctx context.Context, id int) (*domain.Feed, error) {
|
|||
|
||||
var apiKey sql.NullString
|
||||
|
||||
if err := row.Scan(&f.ID, &f.Indexer, &f.Name, &f.Type, &f.Enabled, &f.URL, &f.Interval, &apiKey, &f.CreatedAt, &f.UpdatedAt); err != nil {
|
||||
if err := row.Scan(&f.ID, &f.Indexer, &f.Name, &f.Type, &f.Enabled, &f.URL, &f.Interval, &f.Timeout, &apiKey, &f.CreatedAt, &f.UpdatedAt); err != nil {
|
||||
return nil, errors.Wrap(err, "error scanning row")
|
||||
|
||||
}
|
||||
|
@ -75,6 +76,7 @@ func (r *FeedRepo) FindByIndexerIdentifier(ctx context.Context, indexer string)
|
|||
"enabled",
|
||||
"url",
|
||||
"interval",
|
||||
"timeout",
|
||||
"api_key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
|
@ -96,7 +98,7 @@ func (r *FeedRepo) FindByIndexerIdentifier(ctx context.Context, indexer string)
|
|||
|
||||
var apiKey sql.NullString
|
||||
|
||||
if err := row.Scan(&f.ID, &f.Indexer, &f.Name, &f.Type, &f.Enabled, &f.URL, &f.Interval, &apiKey, &f.CreatedAt, &f.UpdatedAt); err != nil {
|
||||
if err := row.Scan(&f.ID, &f.Indexer, &f.Name, &f.Type, &f.Enabled, &f.URL, &f.Interval, &f.Timeout, &apiKey, &f.CreatedAt, &f.UpdatedAt); err != nil {
|
||||
return nil, errors.Wrap(err, "error scanning row")
|
||||
|
||||
}
|
||||
|
@ -116,6 +118,7 @@ func (r *FeedRepo) Find(ctx context.Context) ([]domain.Feed, error) {
|
|||
"enabled",
|
||||
"url",
|
||||
"interval",
|
||||
"timeout",
|
||||
"api_key",
|
||||
"created_at",
|
||||
"updated_at",
|
||||
|
@ -141,7 +144,7 @@ func (r *FeedRepo) Find(ctx context.Context) ([]domain.Feed, error) {
|
|||
|
||||
var apiKey sql.NullString
|
||||
|
||||
if err := rows.Scan(&f.ID, &f.Indexer, &f.Name, &f.Type, &f.Enabled, &f.URL, &f.Interval, &apiKey, &f.CreatedAt, &f.UpdatedAt); err != nil {
|
||||
if err := rows.Scan(&f.ID, &f.Indexer, &f.Name, &f.Type, &f.Enabled, &f.URL, &f.Interval, &f.Timeout, &apiKey, &f.CreatedAt, &f.UpdatedAt); err != nil {
|
||||
return nil, errors.Wrap(err, "error scanning row")
|
||||
|
||||
}
|
||||
|
@ -164,6 +167,7 @@ func (r *FeedRepo) Store(ctx context.Context, feed *domain.Feed) error {
|
|||
"enabled",
|
||||
"url",
|
||||
"interval",
|
||||
"timeout",
|
||||
"api_key",
|
||||
"indexer_id",
|
||||
).
|
||||
|
@ -174,6 +178,7 @@ func (r *FeedRepo) Store(ctx context.Context, feed *domain.Feed) error {
|
|||
feed.Enabled,
|
||||
feed.URL,
|
||||
feed.Interval,
|
||||
feed.Timeout,
|
||||
feed.ApiKey,
|
||||
feed.IndexerID,
|
||||
).
|
||||
|
@ -199,6 +204,7 @@ func (r *FeedRepo) Update(ctx context.Context, feed *domain.Feed) error {
|
|||
Set("enabled", feed.Enabled).
|
||||
Set("url", feed.URL).
|
||||
Set("interval", feed.Interval).
|
||||
Set("timeout", feed.Timeout).
|
||||
Set("api_key", feed.ApiKey).
|
||||
Where("id = ?", feed.ID)
|
||||
|
||||
|
|
|
@ -298,6 +298,7 @@ CREATE TABLE feed
|
|||
enabled BOOLEAN,
|
||||
url TEXT,
|
||||
interval INTEGER,
|
||||
timeout INTEGER DEFAULT 60,
|
||||
categories TEXT [] DEFAULT '{}' NOT NULL,
|
||||
capabilities TEXT [] DEFAULT '{}' NOT NULL,
|
||||
api_key TEXT,
|
||||
|
@ -557,4 +558,7 @@ CREATE INDEX indexer_identifier_index
|
|||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
`,
|
||||
`ALTER TABLE feed
|
||||
ADD COLUMN timeout INTEGER DEFAULT 60;
|
||||
`,
|
||||
}
|
||||
|
|
|
@ -281,6 +281,7 @@ CREATE TABLE feed
|
|||
enabled BOOLEAN,
|
||||
url TEXT,
|
||||
interval INTEGER,
|
||||
timeout INTEGER DEFAULT 60,
|
||||
categories TEXT [] DEFAULT '{}' NOT NULL,
|
||||
capabilities TEXT [] DEFAULT '{}' NOT NULL,
|
||||
api_key TEXT,
|
||||
|
@ -877,4 +878,7 @@ CREATE INDEX indexer_identifier_index
|
|||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
`,
|
||||
`ALTER TABLE feed
|
||||
ADD COLUMN timeout INTEGER DEFAULT 60;
|
||||
`,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue