1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2025-12-17 14:37:02 +00:00

aliases: Add files unconditionally, to allow for reloads

Today, if the aliases file does not exist when chasquid starts up, the entire
domain will be skipped from aliases resolution.

That's a bug, as it means we don't perform character and suffix replacements
for known domains, and is also an inconvenience as it forces us to reload the
daemon when adding a file for a known domain.

This patch fixes this by adding them unconditionally, even if the file does
not exist.
This commit is contained in:
Alberto Bertogli
2016-09-25 20:33:54 +01:00
parent 469cbd5d76
commit a5ea6c9ba0
2 changed files with 22 additions and 11 deletions

View File

@@ -159,12 +159,10 @@ func loadDomain(name, dir string, s *Server, aliasesR *aliases.Resolver) {
}
}
if _, err := os.Stat(dir + "/aliases"); err == nil {
glog.Infof(" adding aliases")
err := aliasesR.AddAliasesFile(name, dir+"/aliases")
if err != nil {
glog.Errorf(" error: %v", err)
}
glog.Infof(" adding aliases")
err := aliasesR.AddAliasesFile(name, dir+"/aliases")
if err != nil {
glog.Errorf(" error: %v", err)
}
}
@@ -276,7 +274,7 @@ func (s *Server) InitQueue(path string, aliasesR *aliases.Resolver,
// Launch the periodic reload of aliases, now that the queue may care
// about them.
go func() {
for range time.Tick(1 * time.Minute) {
for range time.Tick(30 * time.Second) {
err := aliasesR.Reload()
if err != nil {
glog.Errorf("Error reloading aliases: %v")