-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Многопоточная обработка #14
Conversation
@@ -164,6 +285,10 @@ func (s *databaseStorage) AddURLs(longURLs batchURLs, user string) (batchURLs, e | |||
|
|||
func (s *databaseStorage) CloseFunc() func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
есть ли необходимость в таком усложнении?
может стоит переименовать в Shutdown
и явно вызывать при завершении работы сервиса?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это сделано для того, чтобы можно было универсально вернуть функцию в пакет main, вне зависимости от того, работаем мы с файлом или с БД. Проще повесить её на defer в основной программе, чем отслеживать факт завершения работы сервиса какими-либо специальными средствами.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defer storage.Shutdown()
или определить анонимную функции в самом main
в рамках метода Shutdown
оставить текущую логику, определенную в реализациях
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
return urls | ||
} | ||
|
||
func (s *dummyStorage) deletionQueueProcess(ctx context.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
метод с нереализованной логикой
есть ли необходимость?
switch { | ||
case database != "": | ||
dStorage := newDBStorage(ctx, newMemoryStorage(), database) | ||
dStorage.deletionCancel = deletionCancel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
дублирование кода в ветвлениях
No description provided.