Skip to content

Commit

Permalink
🐛 goingtocamp downtime
Browse files Browse the repository at this point in the history
this change ignores GoingToCamp downtime for up to an hour

resolves #354
  • Loading branch information
juftin committed Aug 5, 2024
1 parent ba4f250 commit 24fd04a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion camply/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Camply Command Line Interface
"""

import concurrent
import logging
import sys
from dataclasses import dataclass
Expand All @@ -20,6 +21,7 @@
)

import click
import tenacity
from rich import traceback
from rich_click import RichCommand, RichGroup, rich_click

Expand Down Expand Up @@ -111,7 +113,9 @@ def _set_up_debug(debug: Optional[bool] = None) -> None:
logger.debug("Camply Version: %s", __version__)
logger.debug("Python Version: %s", sys.version.split(" ")[0])
logger.debug("Platform: %s", sys.platform)
traceback.install(show_locals=debug, suppress=[click, rich_click])
traceback.install(
show_locals=debug, suppress=[click, rich_click, tenacity, concurrent]
)


def _preferred_provider(context: CamplyContext, command_provider: Optional[str]) -> str:
Expand Down
9 changes: 9 additions & 0 deletions camply/providers/going_to_camp/going_to_camp_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
from datetime import datetime
from typing import Any, Dict, List, Optional, Tuple, Union

import tenacity
from fake_useragent import UserAgent
from pydantic import ValidationError
from requests.exceptions import Timeout

from camply.containers import AvailableResource, CampgroundFacility, RecreationArea
from camply.containers.base_container import GoingToCampEquipment
Expand Down Expand Up @@ -485,6 +487,13 @@ def list_equipment_types(self, rec_area_id: int) -> Dict[str, int]:
log_sorted_response(response_array=equipment_types)
return equipment_types

@tenacity.retry(
retry=tenacity.retry_if_exception_type((ConnectionError, Timeout)),
wait=tenacity.wait_exponential(multiplier=3, max=1800),
stop=tenacity.stop.stop_after_delay(6000),
before_sleep=tenacity.before_sleep_log(logger, logging.WARNING),
reraise=True,
)
def list_site_availability(
self,
campground: CampgroundFacility,
Expand Down

0 comments on commit 24fd04a

Please sign in to comment.