Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ac7b37a69 |
+1
-2
@@ -109,8 +109,7 @@ func GenerateCosmoRouterConfigWithExecutor(subGraphs []*model.SubGraph, executor
|
|||||||
// Execute wgc router compose
|
// Execute wgc router compose
|
||||||
// wgc is installed globally in the Docker image
|
// wgc is installed globally in the Docker image
|
||||||
outputFile := filepath.Join(tmpDir, "config.json")
|
outputFile := filepath.Join(tmpDir, "config.json")
|
||||||
output, err := executor.Execute(
|
output, err := executor.Execute("wgc", "router", "compose",
|
||||||
"wgc", "router", "compose",
|
|
||||||
"--input", inputFile,
|
"--input", inputFile,
|
||||||
"--out", outputFile,
|
"--out", outputFile,
|
||||||
"--suppress-warnings",
|
"--suppress-warnings",
|
||||||
|
|||||||
@@ -178,8 +178,7 @@ func (r *mutationResolver) UpdateSubGraph(ctx context.Context, input model.Input
|
|||||||
// same org+ref only trigger one config generation.
|
// same org+ref only trigger one config generation.
|
||||||
r.Debouncer.Debounce(orgId+":"+input.Ref, func() {
|
r.Debouncer.Debounce(orgId+":"+input.Ref, func() {
|
||||||
services, lastUpdate := r.Cache.Services(orgId, input.Ref, "")
|
services, lastUpdate := r.Cache.Services(orgId, input.Ref, "")
|
||||||
r.Logger.Info(
|
r.Logger.Info("Publishing schema update after subgraph change",
|
||||||
"Publishing schema update after subgraph change",
|
|
||||||
"ref", input.Ref,
|
"ref", input.Ref,
|
||||||
"orgId", orgId,
|
"orgId", orgId,
|
||||||
"lastUpdate", lastUpdate,
|
"lastUpdate", lastUpdate,
|
||||||
@@ -211,8 +210,7 @@ func (r *mutationResolver) UpdateSubGraph(ctx context.Context, input model.Input
|
|||||||
CosmoRouterConfig: &cosmoConfig,
|
CosmoRouterConfig: &cosmoConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
r.Logger.Info(
|
r.Logger.Info("Publishing schema update to subscribers",
|
||||||
"Publishing schema update to subscribers",
|
|
||||||
"ref", update.Ref,
|
"ref", update.Ref,
|
||||||
"id", update.ID,
|
"id", update.ID,
|
||||||
"subGraphsCount", len(update.SubGraphs),
|
"subGraphsCount", len(update.SubGraphs),
|
||||||
@@ -248,8 +246,7 @@ func (r *queryResolver) Supergraph(ctx context.Context, ref string, isAfter *str
|
|||||||
orgId := middleware.OrganizationFromContext(ctx)
|
orgId := middleware.OrganizationFromContext(ctx)
|
||||||
userId := middleware.UserFromContext(ctx)
|
userId := middleware.UserFromContext(ctx)
|
||||||
|
|
||||||
r.Logger.Info(
|
r.Logger.Info("Supergraph query",
|
||||||
"Supergraph query",
|
|
||||||
"ref", ref,
|
"ref", ref,
|
||||||
"orgId", orgId,
|
"orgId", orgId,
|
||||||
"userId", userId,
|
"userId", userId,
|
||||||
@@ -315,8 +312,7 @@ func (r *queryResolver) LatestSchema(ctx context.Context, ref string) (*model.Sc
|
|||||||
orgId := middleware.OrganizationFromContext(ctx)
|
orgId := middleware.OrganizationFromContext(ctx)
|
||||||
userId := middleware.UserFromContext(ctx)
|
userId := middleware.UserFromContext(ctx)
|
||||||
|
|
||||||
r.Logger.Info(
|
r.Logger.Info("LatestSchema query",
|
||||||
"LatestSchema query",
|
|
||||||
"ref", ref,
|
"ref", ref,
|
||||||
"orgId", orgId,
|
"orgId", orgId,
|
||||||
"userId", userId,
|
"userId", userId,
|
||||||
@@ -346,8 +342,7 @@ func (r *queryResolver) LatestSchema(ctx context.Context, ref string) (*model.Sc
|
|||||||
|
|
||||||
// Get current services and schema
|
// Get current services and schema
|
||||||
services, lastUpdate := r.Cache.Services(orgId, ref, "")
|
services, lastUpdate := r.Cache.Services(orgId, ref, "")
|
||||||
r.Logger.Info(
|
r.Logger.Info("Fetching latest schema",
|
||||||
"Fetching latest schema",
|
|
||||||
"ref", ref,
|
"ref", ref,
|
||||||
"orgId", orgId,
|
"orgId", orgId,
|
||||||
"lastUpdate", lastUpdate,
|
"lastUpdate", lastUpdate,
|
||||||
@@ -386,8 +381,7 @@ func (r *queryResolver) LatestSchema(ctx context.Context, ref string) (*model.Sc
|
|||||||
CosmoRouterConfig: &cosmoConfig,
|
CosmoRouterConfig: &cosmoConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
r.Logger.Info(
|
r.Logger.Info("Latest schema fetched",
|
||||||
"Latest schema fetched",
|
|
||||||
"ref", update.Ref,
|
"ref", update.Ref,
|
||||||
"id", update.ID,
|
"id", update.ID,
|
||||||
"subGraphsCount", len(update.SubGraphs),
|
"subGraphsCount", len(update.SubGraphs),
|
||||||
@@ -401,8 +395,7 @@ func (r *queryResolver) LatestSchema(ctx context.Context, ref string) (*model.Sc
|
|||||||
func (r *subscriptionResolver) SchemaUpdates(ctx context.Context, ref string) (<-chan *model.SchemaUpdate, error) {
|
func (r *subscriptionResolver) SchemaUpdates(ctx context.Context, ref string) (<-chan *model.SchemaUpdate, error) {
|
||||||
orgId := middleware.OrganizationFromContext(ctx)
|
orgId := middleware.OrganizationFromContext(ctx)
|
||||||
|
|
||||||
r.Logger.Info(
|
r.Logger.Info("SchemaUpdates subscription started",
|
||||||
"SchemaUpdates subscription started",
|
|
||||||
"ref", ref,
|
"ref", ref,
|
||||||
"orgId", orgId,
|
"orgId", orgId,
|
||||||
)
|
)
|
||||||
@@ -419,8 +412,7 @@ func (r *subscriptionResolver) SchemaUpdates(ctx context.Context, ref string) (<
|
|||||||
// Send initial state immediately
|
// Send initial state immediately
|
||||||
go func() {
|
go func() {
|
||||||
services, lastUpdate := r.Cache.Services(orgId, ref, "")
|
services, lastUpdate := r.Cache.Services(orgId, ref, "")
|
||||||
r.Logger.Info(
|
r.Logger.Info("Preparing initial schema update",
|
||||||
"Preparing initial schema update",
|
|
||||||
"ref", ref,
|
"ref", ref,
|
||||||
"orgId", orgId,
|
"orgId", orgId,
|
||||||
"lastUpdate", lastUpdate,
|
"lastUpdate", lastUpdate,
|
||||||
@@ -452,8 +444,7 @@ func (r *subscriptionResolver) SchemaUpdates(ctx context.Context, ref string) (<
|
|||||||
CosmoRouterConfig: &cosmoConfig,
|
CosmoRouterConfig: &cosmoConfig,
|
||||||
}
|
}
|
||||||
|
|
||||||
r.Logger.Info(
|
r.Logger.Info("Sending initial schema update",
|
||||||
"Sending initial schema update",
|
|
||||||
"ref", update.Ref,
|
"ref", update.Ref,
|
||||||
"id", update.ID,
|
"id", update.ID,
|
||||||
"subGraphsCount", len(update.SubGraphs),
|
"subGraphsCount", len(update.SubGraphs),
|
||||||
|
|||||||
+1
-2
@@ -9,8 +9,7 @@ const charset = "abcdefghijklmnopqrstuvwxyz" +
|
|||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||||
|
|
||||||
var seededRand *rand.Rand = rand.New(
|
var seededRand *rand.Rand = rand.New(
|
||||||
rand.NewSource(time.Now().UnixNano()),
|
rand.NewSource(time.Now().UnixNano()))
|
||||||
)
|
|
||||||
|
|
||||||
func StringWithCharset(length int, charset string) string {
|
func StringWithCharset(length int, charset string) string {
|
||||||
b := make([]byte, length)
|
b := make([]byte, length)
|
||||||
|
|||||||
Reference in New Issue
Block a user