forked from mtusi2026/mtusi2026lab3
feat: implement estim 4
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"sync/atomic"
|
||||
|
||||
"messenger/internal/service"
|
||||
)
|
||||
@@ -17,6 +18,7 @@ type Handler struct {
|
||||
messages *service.MessageService
|
||||
deps []Pinger
|
||||
log *slog.Logger
|
||||
draining atomic.Bool
|
||||
}
|
||||
|
||||
func New(users *service.UserService, auth *service.AuthService, chats *service.ChatService,
|
||||
@@ -24,6 +26,10 @@ func New(users *service.UserService, auth *service.AuthService, chats *service.C
|
||||
return &Handler{users: users, auth: auth, chats: chats, messages: messages, deps: deps, log: log}
|
||||
}
|
||||
|
||||
func (h *Handler) StartDraining() {
|
||||
h.draining.Store(true)
|
||||
}
|
||||
|
||||
func (h *Handler) NotFound(w http.ResponseWriter, _ *http.Request) {
|
||||
writeError(w, http.StatusNotFound, "not_found", "resource not found")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user