Repository navigation
Batch update deployment signalled tokens to Subgraph entity - #147
Conversation
| let oldVersionID = subgraph.currentVersion | ||
|
|
||
| versionID = joinID([subgraphID, subgraph.versionCount.toString()]) | ||
| subgraph.currentVersion = versionID |
There was a problem hiding this comment.
Shouldn't let oldVersionID = subgraph.currentVersion line of code be after this line? (After we set subgraph.currentVersion) ?
There was a problem hiding this comment.
We actually want to maintain the previous version id (before we set the new one, even if it's null) that's why I do it before.
This is done to be able to properly update the old version helper entity and also the active amount of subgraphs that currently are linked to this deployment.
davekay100
left a comment
There was a problem hiding this comment.
A few questions from me
| import { createOrLoadSubgraphCategory, createOrLoadSubgraphCategoryRelation, createOrLoadNetwork } from './helpers' | ||
|
|
||
| export function fetchGraphAccountMetadata(graphAccount: GraphAccount, ipfsHash: string): void { | ||
| let ipfsData = ipfs.cat(ipfsHash) |
There was a problem hiding this comment.
Hmm, i remember I did a commit where i made this file git ignored. in fact, .gitignore contains it right now.
i think we can just delete this file from the PR
There was a problem hiding this comment.
Yeah, I'm not 100% sure why it was still being tracked, but since the old version contained conflict strings, I made sure to at least remove that.
I'm gonna go ahead and delete them on the update.
There was a problem hiding this comment.
yeah i think gitignore does a weird thing where if the file EXISTS it doesnt catch it, and will continue to allow you to edit it. but then once you delete it, gitignore works properly.
| newDeployment.activeSubgraphCount = newDeployment.activeSubgraphCount + 1 | ||
| newDeployment.save() | ||
|
|
||
| subgraph.currentVersionRelationEntity = newRelationEntity.id |
There was a problem hiding this comment.
What is the reason for including this field on the subgraph? Just curious
There was a problem hiding this comment.
So we can update the old deployment activeSubgraphCount when it changes to a new deployment. (that counter basically adds a little bit of extra information so you can know how many subgraphs are actively using that deployment as their current version)
| oldDeployment = SubgraphDeployment.load(oldVersion.subgraphDeployment) | ||
| } | ||
| // create deployment - named subgraph relationship, and update the old one | ||
| updateCurrentDeploymentLinks( |
There was a problem hiding this comment.
I think this function, or one similar to it, will have to run on handleSubgraphDeprecated. it might be that we just need to lower the active count, and set active to false. wdyt?
There was a problem hiding this comment.
🤔
maybe, yeah, although technically the subgraph still has the deployment as its' current version, so it might be weird when querying that data 🤔
There was a problem hiding this comment.
Maybe it would be best to track that as a separate count, like having subgraphCount, activeSubgraphCount and deprecatedSubgraphCount, since an active subgraph for the deployment can stop being active because it was upgraded or because it was deprecated
417bb04 to
8d8ef86
Compare
|
@davekaj rebased to fix conflicts, and changed it to implement a different counter when deprecating, while reusing most of the original code. |
|
Currently syncing here: https://thegraph.com/legacy-explorer/subgraph/juanmardefago/dev-subgraph?version=pending |
Currently syncing here: https://thegraph.com/legacy-explorer/subgraph/juanmardefago/dev-subgraph?version=pending
Also fixed some inconsistent spacing on some files, and a weird conflict on a file that we stopped versioning a while ago.