-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add cancellation to RPC handlers #846
base: staging
Are you sure you want to change the base?
Add cancellation to RPC handlers #846
Conversation
For each RPC handler, we need to provide a Should I make a commit into |
Don't bother defining the type for it unless you're actually using it. So you can just name the |
I just did this to mute the warnings for type hints, as TS assumes it is |
const commits = new Set<string>(); | ||
const trees = new Set<string>(); | ||
const blobs = new Set<string>(); | ||
const tags = new Set<string>(); | ||
const havesSet: Set<string> = new Set(haves); | ||
|
||
async function walk(objectId: ObjectId, type: ObjectType): Promise<void> { | ||
// ctx.signal.throwIfAborted(); | ||
// If object was listed as a have then we don't need to walk over it | ||
if (havesSet.has(objectId)) return; | ||
switch (type) { |
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.
This method is used in VaultInternal
in garbageCollectGitObjects
, which is called when initialising VaultInternal
. As such, we don't have access to a context. Should I manually create a context and pass it in, or make context an optional parameter here?
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.
You'll need to pass the ctx
to whatever needs it. For public methods in a class you should use the @timedCancellable
decorator. Look at other cancellable methods for reference. For internal methods you can just pass along the ctx
.
Description
Without proper abortion or cancellation for a RPC, it will keep running and conclude first. This ends up adding a significant amount of time when closing the agent, as all outstanding RPC calls must resolve beforehand.
Issues Fixed
Tasks
AgentLockAll
AgentStatus
AgentStop
AgentUnlock
AuditEventsGet
AuditMetricGet
GestaltsActionsGetByIdentity
GestaltsActionsGetByNode
GestaltsActionsSetByIdentity
GestaltsActionsSetByNode
GestaltsActionsUnsetByIdentity
GestaltsActionsUnsetByNode
GestaltsDiscoveryByIdentity
GestaltsDiscoveryByNode
GestaltsDiscoveryQueue
GestaltsGestaltsGetByIdentity
GestaltsGestaltsGetByNode
GestaltsGestaltsList
GestaltsGestaltsTrustByIdentity
GestaltsGestaltsTrustByNode
IdentitiesAuthenticate
IdentitiesAuthenticatedGet
IdentitiesClaim
IdentitiesInfoConnectedGet
IdentitiesInfoGet
IdentitiesInvite
IdentitiesProvidersList
IdentitiesTokenDelete
IdentitiesTokenGet
IdentitiesTokenPut
KeysCertsChainGet
KeysCertsGet
KeysDecrypt
KeysEncrypt
KeysKeyPair
KeysKeyPairRenew
KeysKeyPairReset
KeysPasswordChange
KeysPublicKey
KeysSign
KeysVerify
NodesAdd
NodesClaim
NodesFind
NodesGetAll
NodesListConnections
NodesPing
NotificationsInboxClear
NotificationsInboxRead
NotificationsInboxRemove
NotificationsOutboxClear
NotificationsOutboxClear
NotificationsOutboxRead
NotificationsOutboxRemove
NotificationsSend
VaultsClone
VaultsCreate
VaultsDelete
VaultsList
VaultsLog
VaultsPermissionGet
VaultsPermissionSet
VaultsPermissionUnset
VaultsPull
VaultsRename
VaultsScan
VaultsSecretsCat
VaultsSecretsEnv
VaultsSecretsGet
VautlsSecretsList
VaultsSecretsMkdir
VaultsSecretsNew
VaultsSecretsNewDir
VaultsSecretsRemove
VaultsSecretsRename
VaultsSecretsStat
VaultsSecretsWriteFile
VaultsVersion
Final checklist