Skip to content

Commit

Permalink
fix: address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alecthomas committed Sep 14, 2024
1 parent 9126dca commit dd41626
Show file tree
Hide file tree
Showing 13 changed files with 251 additions and 258 deletions.
10 changes: 5 additions & 5 deletions backend/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func New(ctx context.Context, conn *sql.DB, config Config, devel bool) (*Service
config.ControllerTimeout = time.Second * 5
}

encryption, err := encryption.New(ctx, conn, ftlencryption.NewBuilder().WithKMSURI(optional.Ptr(config.KMSURI)))
encryption, err := encryption.New(ctx, conn, api.NewBuilder().WithKMSURI(optional.Ptr(config.KMSURI)))
if err != nil {
return nil, fmt.Errorf("failed to create encryption dal: %w", err)
}
Expand Down Expand Up @@ -1073,12 +1073,13 @@ func (s *Service) callWithRequest(

response, err := client.verb.Call(ctx, req)
var resp *connect.Response[ftlv1.CallResponse]
var maybeResponse optional.Option[*ftlv1.CallResponse]
var callResponse either.Either[*ftlv1.CallResponse, error]
if err == nil {
resp = connect.NewResponse(response.Msg)
maybeResponse = optional.Some(resp.Msg)
callResponse = either.LeftOf[error](resp.Msg)
observability.Calls.Request(ctx, req.Msg.Verb, start, optional.None[string]())
} else {
callResponse = either.RightOf[*ftlv1.CallResponse](err)
observability.Calls.Request(ctx, req.Msg.Verb, start, optional.Some("verb call failed"))
}
s.timeline.RecordCall(ctx, &timeline.Call{
Expand All @@ -1088,9 +1089,8 @@ func (s *Service) callWithRequest(
StartTime: start,
DestVerb: verbRef,
Callers: callers,
CallError: optional.Nil(err),
Request: req.Msg,
Response: maybeResponse,
Response: callResponse,
})
return resp, err
}
Expand Down
89 changes: 89 additions & 0 deletions backend/controller/dal/internal/sql/deployment_queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions backend/controller/dal/internal/sql/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 0 additions & 40 deletions backend/controller/dal/internal/sql/queries.sql
Original file line number Diff line number Diff line change
Expand Up @@ -205,46 +205,6 @@ FROM runners r
WHERE state = 'assigned'
AND d.key = sqlc.arg('key')::deployment_key;

-- name: InsertTimelineDeploymentCreatedEvent :exec
INSERT INTO timeline (
deployment_id,
type,
custom_key_1,
custom_key_2,
payload
)
VALUES (
(
SELECT id
FROM deployments
WHERE deployments.key = sqlc.arg('deployment_key')::deployment_key
),
'deployment_created',
sqlc.arg('language')::TEXT,
sqlc.arg('module_name')::TEXT,
sqlc.arg('payload')
);

-- name: InsertTimelineDeploymentUpdatedEvent :exec
INSERT INTO timeline (
deployment_id,
type,
custom_key_1,
custom_key_2,
payload
)
VALUES (
(
SELECT id
FROM deployments
WHERE deployments.key = sqlc.arg('deployment_key')::deployment_key
),
'deployment_updated',
sqlc.arg('language')::TEXT,
sqlc.arg('module_name')::TEXT,
sqlc.arg('payload')
);

-- name: CreateRequest :exec
INSERT INTO requests (origin, "key", source_addr)
VALUES ($1, $2, $3);
Expand Down
154 changes: 0 additions & 154 deletions backend/controller/dal/internal/sql/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions backend/controller/timeline/dal/dal.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ import (
"strconv"
"time"

"github.com/alecthomas/types/optional"

"github.com/TBD54566975/ftl/backend/controller/encryption"
ftlencryption "github.com/TBD54566975/ftl/backend/controller/encryption/api"
"github.com/TBD54566975/ftl/backend/controller/sql/sqltypes"
"github.com/TBD54566975/ftl/backend/controller/timeline/dal/internal/sql"
"github.com/TBD54566975/ftl/backend/libdal"
"github.com/TBD54566975/ftl/backend/schema"
ftlencryption "github.com/TBD54566975/ftl/internal/encryption"
"github.com/TBD54566975/ftl/internal/log"
"github.com/TBD54566975/ftl/internal/model"
"github.com/alecthomas/types/optional"
)

type DAL struct {
Expand Down
Loading

0 comments on commit dd41626

Please sign in to comment.