mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
queue: Check that we can create the queue directory
When creating a new Queue instance, we os.MkdirAll the queue directory. Currently we don't check if it fails, which will cause us to find out about problems when the queue is first used, where it is more annoying to troubleshoot. This patch adjusts the code so that we check and propagate the error. That way, problems with the queue directory will be more evident and easier to handle.
This commit is contained in:
@@ -108,11 +108,10 @@ type Queue struct {
|
||||
|
||||
// New creates a new Queue instance.
|
||||
func New(path string, localDomains *set.String, aliases *aliases.Resolver,
|
||||
localC, remoteC courier.Courier) *Queue {
|
||||
localC, remoteC courier.Courier) (*Queue, error) {
|
||||
|
||||
os.MkdirAll(path, 0700)
|
||||
|
||||
return &Queue{
|
||||
err := os.MkdirAll(path, 0700)
|
||||
q := &Queue{
|
||||
q: map[string]*Item{},
|
||||
localC: localC,
|
||||
remoteC: remoteC,
|
||||
@@ -120,6 +119,7 @@ func New(path string, localDomains *set.String, aliases *aliases.Resolver,
|
||||
path: path,
|
||||
aliases: aliases,
|
||||
}
|
||||
return q, err
|
||||
}
|
||||
|
||||
// Load the queue and launch the sending loops on startup.
|
||||
|
||||
Reference in New Issue
Block a user