update
All checks were successful
Build and Publish / BuildAndDeployAmd64 (push) Successful in 37s
Build and Publish / BuildAndDeployArm64 (push) Successful in 4m29s

This commit is contained in:
matst80
2025-12-02 09:26:30 +01:00
parent d8791788fc
commit ebd1508294
3 changed files with 13 additions and 1 deletions

View File

@@ -768,6 +768,17 @@ func (s *PoolServer) AdyenSessionHandler(w http.ResponseWriter, r *http.Request,
} }
func (s *PoolServer) GetAnywhere(ctx context.Context, cartId cart.CartId) (*cart.CartGrain, error) {
id := uint64(cartId)
if host, isOnOtherHost := s.OwnerHost(id); isOnOtherHost {
grain := &cart.CartGrain{}
err := host.Get(ctx, id, grain)
return grain, err
}
return s.Get(ctx, id)
}
func (s *PoolServer) ApplyAnywhere(ctx context.Context, cartId cart.CartId, msgs ...proto.Message) error { func (s *PoolServer) ApplyAnywhere(ctx context.Context, cartId cart.CartId, msgs ...proto.Message) error {
id := uint64(cartId) id := uint64(cartId)
if host, isOnOtherHost := s.OwnerHost(id); isOnOtherHost { if host, isOnOtherHost := s.OwnerHost(id); isOnOtherHost {

View File

@@ -37,6 +37,7 @@ type Host interface {
Name() string Name() string
Proxy(id uint64, w http.ResponseWriter, r *http.Request, customBody io.Reader) (bool, error) Proxy(id uint64, w http.ResponseWriter, r *http.Request, customBody io.Reader) (bool, error)
Apply(ctx context.Context, id uint64, mutation ...proto.Message) (bool, error) Apply(ctx context.Context, id uint64, mutation ...proto.Message) (bool, error)
Get(ctx context.Context, id uint64, grain any) error
GetActorIds() []uint64 GetActorIds() []uint64
Close() error Close() error
Ping() bool Ping() bool

View File

@@ -131,7 +131,7 @@ func (h *RemoteHost[V]) Ping() bool {
return true return true
} }
func (h *RemoteHost[V]) Get(ctx context.Context, id uint64, grain *V) error { func (h *RemoteHost[V]) Get(ctx context.Context, id uint64, grain any) error {
ctx, cancel := context.WithTimeout(ctx, 5*time.Second) ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel() defer cancel()
reply, error := h.controlClient.Get(ctx, &messages.GetRequest{Id: id}) reply, error := h.controlClient.Get(ctx, &messages.GetRequest{Id: id})