singer-io / tap-marketo

GNU Affero General Public License v3.0
9 stars 17 forks source link

Tdl 24072 fix typecasting bug max api limit #84

Closed somethingmorerelevant closed 1 year ago

somethingmorerelevant commented 1 year ago

Description of change

Manual QA steps

Risks

Rollback steps

somethingmorerelevant commented 1 year ago
try:
     self.max_daily_calls = int(max_daily_calls or MAX_DAILY_CALLS)
     if self.max_daily_calls <= 1:
        raise ValueError("Limit Cannot be Negative or Zero")
except (ValueError, TypeError) as err:
    singer.log_critical(f"Invalid Value passed for max_daily_calls: {max_daily_calls}")
     raise err

This is the only issue i see with the current implementation👇🏼

If the value is passed as a string "0" it throws an exception since the value is negative/zero, but if the same value is passed as 0 it sets it to default.

eg:

>>> int("0" or 40000)
0
>>> int(0 or 40000)
40000