Skip to content

Commit 09ad1a1

Browse files
committed
Delete format duration
1 parent 245fb3e commit 09ad1a1

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

airbyte_cdk/sources/declarative/declarative_component_schema.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1426,7 +1426,6 @@ definitions:
14261426
title: Period
14271427
description: The time interval for the rate limit window.
14281428
type: string
1429-
format: duration
14301429
call_limit:
14311430
title: Call Limit
14321431
description: The maximum number of calls allowed within the period.

airbyte_cdk/sources/declarative/models/declarative_component_schema.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from __future__ import annotations
55

6-
from datetime import timedelta
76
from enum import Enum
87
from typing import Any, Dict, List, Literal, Optional, Union
98

@@ -1632,7 +1631,7 @@ class Config:
16321631
extra = Extra.allow
16331632

16341633
type: Literal["FixedWindowCallRatePolicy"]
1635-
period: timedelta = Field(
1634+
period: str = Field(
16361635
..., description="The time interval for the rate limit window.", title="Period"
16371636
)
16381637
call_limit: int = Field(

airbyte_cdk/sources/declarative/parsers/model_to_component_factory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2973,7 +2973,7 @@ def create_http_api_budget(
29732973
policies=policies,
29742974
ratelimit_reset_header=model.ratelimit_reset_header or "ratelimit-reset",
29752975
ratelimit_remaining_header=model.ratelimit_remaining_header or "ratelimit-remaining",
2976-
status_codes_for_ratelimit_hit=model.status_codes_for_ratelimit_hit or (429,),
2976+
status_codes_for_ratelimit_hit=model.status_codes_for_ratelimit_hit or [429],
29772977
)
29782978

29792979
def create_fixed_window_call_rate_policy(
@@ -2988,7 +2988,7 @@ def create_fixed_window_call_rate_policy(
29882988
# This value will be updated by the first request.
29892989
return FixedWindowCallRatePolicy(
29902990
next_reset_ts=datetime.datetime.now() + datetime.timedelta(days=10),
2991-
period=model.period,
2991+
period=parse_duration(model.period),
29922992
call_limit=model.call_limit,
29932993
matchers=matchers,
29942994
)

airbyte_cdk/sources/streams/call_rate.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
import logging
99
import re
1010
import time
11-
from dataclasses import InitVar, dataclass, field
1211
from datetime import timedelta
1312
from threading import RLock
14-
from typing import TYPE_CHECKING, Any, Mapping, Optional, Union
13+
from typing import TYPE_CHECKING, Any, Mapping, Optional
1514
from urllib import parse
1615

1716
import requests
@@ -653,7 +652,7 @@ def __init__(
653652
self,
654653
ratelimit_reset_header: str = "ratelimit-reset",
655654
ratelimit_remaining_header: str = "ratelimit-remaining",
656-
status_codes_for_ratelimit_hit: Union[tuple[int], list[int]] = (429,),
655+
status_codes_for_ratelimit_hit: list[int] = [429],
657656
**kwargs: Any,
658657
):
659658
"""Constructor

0 commit comments

Comments
 (0)