aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--main.go26
1 files changed, 17 insertions, 9 deletions
diff --git a/main.go b/main.go
index 86a6ddf..26582b7 100644
--- a/main.go
+++ b/main.go
@@ -101,24 +101,32 @@ func run() error {
return nil
}
- if success := state.Fetch(); success == 0 {
- return fmt.Errorf("No successful feed fetch.")
- }
-
- state.Filter()
-
+ imapErr := make(chan error, 1)
var c *imap.Client
if !dryRun && !buildCache {
- if c, err = imap.Connect(cfg.Target); err != nil {
- return err
- }
+ go func() {
+ var err error
+ c, err = imap.Connect(cfg.Target)
+ imapErr <- err
+ }()
defer c.Disconnect()
}
+ if success := state.Fetch(); success == 0 {
+ return fmt.Errorf("No successful feed fetch.")
+ }
+
+ state.Filter()
+
if buildCache {
state.Foreach(cache.CachedFeed.Commit)
} else {
+ if !dryRun {
+ if err = <-imapErr; err != nil {
+ return err
+ }
+ }
state.ForeachGo(func(f cache.CachedFeed) {
processFeed(f, c, dryRun)
})