-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #264 from rossneilson/release/v3.1.0
Release/v3.1.0 - sync with develop
- Loading branch information
Showing
40 changed files
with
711 additions
and
233 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 47 additions & 3 deletions
50
apps/davi/src/stores/modules/1_5/checkDataSourceAvailability.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,51 @@ | ||
import { subgraphClientsUris } from 'clients/apollo'; | ||
import { SupportedSubgraph } from 'stores/types'; | ||
|
||
// TODO: Check for health of connection if found | ||
export const checkDataSourceAvailability = async chainId => { | ||
try { | ||
if (!!subgraphClientsUris?.[chainId]?.[SupportedSubgraph.Governance1_5]) { | ||
console.debug('No subgraph URL for this chain, using fallback'); | ||
return false; | ||
} | ||
|
||
export const checkDataSourceAvailability = chainId => { | ||
return !!subgraphClientsUris[chainId]['Governance1.5']; | ||
const query = `{ | ||
_meta { | ||
block { | ||
number | ||
timestamp | ||
} | ||
} | ||
}`; | ||
|
||
const response = await fetch( | ||
subgraphClientsUris[chainId][SupportedSubgraph.Governance1_5], | ||
{ | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ query }), | ||
} | ||
); | ||
const { data, errors } = await response.json(); | ||
|
||
if (data?._meta?.block?.timestamp < Math.floor(Date.now() / 1000) - 600) { | ||
console.debug('Subgraph out of sync, using fallback'); | ||
return false; | ||
} | ||
if (errors) { | ||
console.debug('Error occurred checking source health'); | ||
console.error(errors); | ||
return false; | ||
} | ||
if (data) { | ||
console.debug('Subgraph exists and is above 10 minutes in sync'); | ||
return true; | ||
} else { | ||
console.debug('No default data source data, using fallback'); | ||
return false; | ||
} | ||
} catch { | ||
return false; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 3 additions & 5 deletions
8
apps/davi/src/stores/modules/1_5/fetchers/subgraph/useGetMemberList/useGetMemberList.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
daf205a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
davi – ./
davi-git-develop-dxgov.vercel.app
davi-dxgov.vercel.app
project-davi.dev
davi-monorepo-davi.vercel.app