Skip to content

Commit

Permalink
Trigger Dashboard Query Refresh (#287)
Browse files Browse the repository at this point in the history
People keep having issues with the dashboard query being out of sync
when they land on the dashboard page. This will trigger refresh (in the
background) at script runtime.
  • Loading branch information
bh2smith authored May 22, 2023
1 parent 191deb3 commit 3c284e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/fetch/dune.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ def get_period_slippage(self, job_id: Optional[str] = None) -> list[DuneRecord]:
Returns a class representation of the results as two lists (positive & negative).
"""
token_list = get_trusted_tokens()
params = self._period_params() + [
QueryParameter.text_type("TxHash", "0x"),
QueryParameter.text_type("TokenList", ",".join(token_list)),
]
# trigger dashboard update
self.dune.execute(
self._parameterized_query(QUERIES["DASHBOARD_SLIPPAGE"], params=params)
)

return self._get_query_results(
self._parameterized_query(
QUERIES["PERIOD_SLIPPAGE"],
Expand Down
5 changes: 5 additions & 0 deletions src/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ def with_params(self, params: list[QueryParameter]) -> Query:
filepath="period_slippage.sql",
q_id=2259597,
),
"DASHBOARD_SLIPPAGE": QueryData(
name="Dashboard Slippage for Period",
filepath="not currently stored in project",
q_id=2283297,
),
}

0 comments on commit 3c284e6

Please sign in to comment.