Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce ping_frequency #94

Merged
merged 3 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading