12de5a230a
- suggestion_service: fix scorer (stringList unmarshal accepts scalar|array; anchor scoring on base universal score so bool matches no longer tie); add localizeReasons for human-readable, Accept-Language-localized match reasons - lookup_i18n: localize lookup display names, home-profile options, document types/categories via internal/i18n - static_data_handler: per-locale seeded-data response (display_name, home profile options, document types/categories) with per-locale cache + ETag - settings_handler: invalidate per-locale seeded-data cache on lookup change instead of pre-warming a single non-localized blob - cache_service: per-locale seeded-data keys + ETag - DTOs: add DisplayName fields (task/residence/contractor) - translations: add suggestion.reason.* and lookup.* keys across all 10 langs - cmd/api: extract startup helpers + tests Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
33 lines
872 B
Go
33 lines
872 B
Go
package main
|
|
|
|
import "time"
|
|
|
|
// shouldInitEmail returns true if email config has host and user set.
|
|
func shouldInitEmail(host, user string) bool {
|
|
return host != "" && user != ""
|
|
}
|
|
|
|
// shouldInitStorage returns true if upload directory is configured.
|
|
func shouldInitStorage(uploadDir string) bool {
|
|
return uploadDir != ""
|
|
}
|
|
|
|
// shouldInitEncryption returns true if encryption key is set.
|
|
func shouldInitEncryption(encryptionKey string) bool {
|
|
return encryptionKey != ""
|
|
}
|
|
|
|
// connectWithRetry attempts a connection with exponential backoff.
|
|
// Returns nil on success or the last error after all retries fail.
|
|
func connectWithRetry(connect func() error, maxRetries int) error {
|
|
var err error
|
|
for i := 0; i < maxRetries; i++ {
|
|
err = connect()
|
|
if err == nil {
|
|
return nil
|
|
}
|
|
time.Sleep(time.Duration(i+1) * time.Millisecond) // use ms in tests
|
|
}
|
|
return err
|
|
}
|