Сделать отправку сообщения идемпотентной по Idempotency-Key с общей таблицей ключей и их чисткой
This commit is contained in:
+8
-1
@@ -50,9 +50,16 @@ type Deps struct {
|
||||
// request that gives up on a dependency can still write its 503.
|
||||
const defaultRequestTimeout = 5 * time.Second
|
||||
|
||||
// defaultIdempotencyTTL is the contract's retention of message keys.
|
||||
const defaultIdempotencyTTL = 24 * time.Hour
|
||||
|
||||
func New(d Deps) *App {
|
||||
users := user.NewService(userstore.NewUsers(d.DB))
|
||||
chats := chat.NewService(chatstore.NewChats(d.DB), chatstore.NewMessages(d.DB), users)
|
||||
keyTTL := d.IdempotencyTTL
|
||||
if keyTTL == 0 {
|
||||
keyTTL = defaultIdempotencyTTL
|
||||
}
|
||||
chats := chat.NewService(chatstore.NewChats(d.DB), chatstore.NewMessages(d.DB), users, keyTTL)
|
||||
|
||||
engine := httpx.NewEngine(d.Log, d.MaxBodyBytes, d.InstanceID)
|
||||
probes := health.New(
|
||||
|
||||
Reference in New Issue
Block a user