You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Define a lease namespace.varuserUpdateLease=ftl.Lease("user", "update")
//ftl:exportfuncUpdateUser(ctx context.Context, reqUpdateUserRequest) error {
// Obtain a lease on a single user.deferuserLease.Acquire(ctx, req.UserId).Release()
// Do a bunch of stuff.
}
The lease key should be a hierarchy perhaps? Should acquiring a lease on user acquire it for all children? Should we even do that?
Leases would need a table, and a reaper job to cleanup expired leases. We are using a similar concept already for runner and controller reservations which we could probably rewrite using these.
Or should the API be more like:
funcLease(ctx context.Context, key...string) LeaseReservation//ftl:exportfuncUpdateUser(ctx context.Context, reqUpdateUserRequest) error {
// Obtain a lease on a single user.deferftl.Lease(ctx, "update", "user", req.UserId).Release()
// Do a bunch of stuff.
}
Will probably need an additional method on VerbService for renewing the lease.
The text was updated successfully, but these errors were encountered:
Leases are super useful for all kinds of things.
The lease key should be a hierarchy perhaps? Should acquiring a lease on
user
acquire it for all children? Should we even do that?Leases would need a table, and a reaper job to cleanup expired leases. We are using a similar concept already for runner and controller reservations which we could probably rewrite using these.
Or should the API be more like:
Will probably need an additional method on
VerbService
for renewing the lease.The text was updated successfully, but these errors were encountered: