diff options
author | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-23 20:10:05 +0200 |
---|---|---|
committer | René 'Necoro' Neumann <necoro@necoro.eu> | 2020-04-23 20:10:05 +0200 |
commit | 6bd87a567ef481b922f6baec2b475ec376c45443 (patch) | |
tree | d13c1995234acd3a07d16dafb009aa53ba05a7cb /main.go | |
parent | 7bfe97f3e72279a17c16803d64a16beb55944332 (diff) | |
download | feed2imap-go-6bd87a567ef481b922f6baec2b475ec376c45443.tar.gz feed2imap-go-6bd87a567ef481b922f6baec2b475ec376c45443.tar.bz2 feed2imap-go-6bd87a567ef481b922f6baec2b475ec376c45443.zip |
Concurrent imap
Diffstat (limited to '')
-rw-r--r-- | main.go | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -31,13 +31,15 @@ func processFeed(feed *feed.Feed, cfg *config.Config, client *imap.Client, wg *s } folder := client.NewFolder(feed.Target) - client.EnsureFolder(folder, func(err error) string { - return fmt.Sprintf("Creating folder of feed %s: %s", feed.Name, err) - }) + if err = client.EnsureFolder(folder); err != nil { + log.Errorf("Creating folder of feed %s: %s", feed.Name, err) + return + } - client.PutMessages(folder, mails, func(err error) string { - return fmt.Sprintf("Uploading messages of feed %s: %s", feed.Name, err) - }) + if err = client.PutMessages(folder, mails); err != nil { + log.Errorf("Uploading messages of feed %s: %s", feed.Name, err) + return + } log.Printf("Uploaded %d messages to '%s' @ %s", len(mails), feed.Name, folder) } |