- Added configuration options for Stalwart hosted mail in .env.example. - Updated Docker Compose to include Stalwart service with health checks. - Introduced new API endpoints for managing mail domains and migration projects. - Enhanced Authentik blueprints for user enrollment and post-migration security. - Updated OAuth handling for Google and Microsoft migration processes. - Improved error handling and response structures in the mail API. - Added integration tests for email claiming and migration workflows.
47 lines
972 B
Go
47 lines
972 B
Go
package migration
|
|
|
|
import "sync"
|
|
|
|
const (
|
|
defaultMailImportBatchSize = 25
|
|
defaultDriveImportBatchSize = 10
|
|
)
|
|
|
|
// ImportBatchConfig controls how many items each migration importer processes per worker tick.
|
|
type ImportBatchConfig struct {
|
|
Mail int
|
|
Drive int
|
|
}
|
|
|
|
var (
|
|
importBatchMu sync.RWMutex
|
|
importBatchConfig = ImportBatchConfig{
|
|
Mail: defaultMailImportBatchSize,
|
|
Drive: defaultDriveImportBatchSize,
|
|
}
|
|
)
|
|
|
|
// ConfigureImportBatch sets package-wide batch sizes for migration importers.
|
|
func ConfigureImportBatch(cfg ImportBatchConfig) {
|
|
importBatchMu.Lock()
|
|
defer importBatchMu.Unlock()
|
|
if cfg.Mail > 0 {
|
|
importBatchConfig.Mail = cfg.Mail
|
|
}
|
|
if cfg.Drive > 0 {
|
|
importBatchConfig.Drive = cfg.Drive
|
|
}
|
|
}
|
|
|
|
func mailImportBatchSize() int {
|
|
importBatchMu.RLock()
|
|
defer importBatchMu.RUnlock()
|
|
return importBatchConfig.Mail
|
|
}
|
|
|
|
func driveImportBatchSize() int {
|
|
importBatchMu.RLock()
|
|
defer importBatchMu.RUnlock()
|
|
return importBatchConfig.Drive
|
|
}
|