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 6bc23c1
Show file tree
Hide file tree
Showing 13 changed files with 249 additions and 256 deletions.
8 changes: 4 additions & 4 deletions backend/controller/controller.go
Original file line number Diff line number Diff line change
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.

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

"github.com/alecthomas/types/optional"

"github.com/TBD54566975/ftl/backend/controller/encryption"
"github.com/TBD54566975/ftl/backend/controller/sql/sqltypes"
"github.com/TBD54566975/ftl/backend/controller/timeline/dal/internal/sql"
Expand All @@ -16,7 +18,6 @@ import (
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 6bc23c1

Please sign in to comment.