Skip to content

Commit

Permalink
Merge pull request #94 from duneanalytics/ping-frequency
Browse files Browse the repository at this point in the history
Reduce ping_frequency
  • Loading branch information
msf authored Sep 22, 2023
2 parents 0578771 + fb225f9 commit b510c97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pip install dune-client

# Example Usage

## Quickstart: run_sql
## Quickstart: run_query

Export your `DUNE_API_KEY` (or place it in a `.env` file - as in
here [.env.sample](./.env.sample) and `source .env`).
Expand Down
17 changes: 10 additions & 7 deletions dune_client/api/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
from dune_client.types import QueryParameter
from dune_client.util import age_in_hours

# This is the expiry time on old query results.
THREE_MONTHS_IN_HOURS = 2191
# Seconds between checking execution status
POLL_FREQUENCY_SECONDS = 1


class ExtendedAPI(ExecutionAPI, QueryAPI):
Expand All @@ -36,7 +39,7 @@ class ExtendedAPI(ExecutionAPI, QueryAPI):
def run_query(
self,
query: QueryBase,
ping_frequency: int = 5,
ping_frequency: int = POLL_FREQUENCY_SECONDS,
performance: Optional[str] = None,
) -> ResultsResponse:
"""
Expand All @@ -50,7 +53,7 @@ def run_query(
def run_query_csv(
self,
query: QueryBase,
ping_frequency: int = 5,
ping_frequency: int = POLL_FREQUENCY_SECONDS,
performance: Optional[str] = None,
) -> ExecutionResultCSV:
"""
Expand All @@ -64,7 +67,7 @@ def run_query_csv(
def run_query_dataframe(
self,
query: QueryBase,
ping_frequency: int = 5,
ping_frequency: int = POLL_FREQUENCY_SECONDS,
performance: Optional[str] = None,
) -> Any:
"""
Expand Down Expand Up @@ -183,7 +186,7 @@ def run_sql(
def refresh(
self,
query: QueryBase,
ping_frequency: int = 5,
ping_frequency: int = POLL_FREQUENCY_SECONDS,
performance: Optional[str] = None,
) -> ResultsResponse:
"""
Expand All @@ -197,7 +200,7 @@ def refresh(
def refresh_csv(
self,
query: QueryBase,
ping_frequency: int = 5,
ping_frequency: int = POLL_FREQUENCY_SECONDS,
performance: Optional[str] = None,
) -> ExecutionResultCSV:
"""
Expand All @@ -211,7 +214,7 @@ def refresh_csv(
def refresh_into_dataframe(
self,
query: QueryBase,
ping_frequency: int = 5,
ping_frequency: int = POLL_FREQUENCY_SECONDS,
performance: Optional[str] = None,
) -> Any:
"""
Expand All @@ -228,7 +231,7 @@ def refresh_into_dataframe(
def _refresh(
self,
query: QueryBase,
ping_frequency: int = 5,
ping_frequency: int = POLL_FREQUENCY_SECONDS,
performance: Optional[str] = None,
) -> str:
"""
Expand Down

0 comments on commit b510c97

Please sign in to comment.