mirror of
https://github.com/cirruslabs/orchard.git
synced 2026-09-30 03:51:43 +02:00
Refactor listing VMs (#399)
* Removed unnesesary ListOptions * Refactor genericList to accept string prefixes instead of byte slices * Optimize VM listing logic with singleflight to deduplicate concurrent request * Refactor VM listing logic: rename variables for clarity and update error messages * fix: address PR review feedback - use singleflight DoChan with context cancellation for list VMs 🤖 Generated with [Codex](https://chatgpt.com/codex) Co-Authored-By: Codex <codex@openai.com> --------- Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
@@ -29,6 +29,7 @@ import (
|
||||
"golang.org/x/crypto/ssh"
|
||||
"golang.org/x/net/http2"
|
||||
"golang.org/x/net/http2/h2c"
|
||||
"golang.org/x/sync/singleflight"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/keepalive"
|
||||
)
|
||||
@@ -73,6 +74,8 @@ type Controller struct {
|
||||
sshNoClientAuth bool
|
||||
sshServer *sshserver.SSHServer
|
||||
|
||||
single singleflight.Group
|
||||
|
||||
rpc.UnimplementedControllerServer
|
||||
}
|
||||
|
||||
@@ -83,6 +86,7 @@ func New(opts ...Option) (*Controller, error) {
|
||||
workerOfflineTimeout: 3 * time.Minute,
|
||||
maxWorkersPerLicense: maxWorkersPerDefaultLicense,
|
||||
pingInterval: 30 * time.Second,
|
||||
single: singleflight.Group{},
|
||||
}
|
||||
|
||||
// Apply options
|
||||
|
||||
Reference in New Issue
Block a user