From ed1e06e6d81645fb5fedd89018c30f95b7598f84 Mon Sep 17 00:00:00 2001 From: René 'Necoro' Neumann Date: Sun, 19 Apr 2020 22:41:41 +0200 Subject: Rename package 'parse' to 'feed' --- internal/parse/parse.go | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) delete mode 100644 internal/parse/parse.go (limited to 'internal/parse/parse.go') diff --git a/internal/parse/parse.go b/internal/parse/parse.go deleted file mode 100644 index ddf1f0f..0000000 --- a/internal/parse/parse.go +++ /dev/null @@ -1,48 +0,0 @@ -package parse - -import ( - ctxt "context" - "fmt" - "sync" - "time" - - "github.com/mmcdole/gofeed" - - "github.com/Necoro/feed2imap-go/internal/config" - "github.com/Necoro/feed2imap-go/internal/log" -) - -func context() (ctxt.Context, ctxt.CancelFunc) { - return ctxt.WithTimeout(ctxt.Background(), 60*time.Second) -} - -func parseFeed(feed *config.Feed) error { - ctx, cancel := context() - defer cancel() - fp := gofeed.NewParser() - if _, err := fp.ParseURLWithContext(feed.Url, ctx); err != nil { - return fmt.Errorf("while fetching %s from %s: %w", feed.Name, feed.Url, err) - } - - return nil -} - -func handleFeed(feed *config.Feed, wg *sync.WaitGroup) { - defer wg.Done() - log.Printf("Fetching %s from %s", feed.Name, feed.Url) - - if err := parseFeed(feed); err != nil { - log.Error(err) - } -} - -func Parse(feeds config.Feeds) { - var wg sync.WaitGroup - wg.Add(len(feeds)) - - for _, feed := range feeds { - go handleFeed(feed, &wg) - } - - wg.Wait() -} -- cgit v1.2.3-70-g09d2 id=9b25dffcc59cbd65a90fa84acccb01b8ff5c704b&follow=1'>diff
path: root/.vim (unfollow)
Commit message (Collapse)AuthorFilesLines
2010-04-02Screen stuffRené 'Necoro' Neumann2-1/+6
2010-04-02Add 'screen' notification in the promptRené 'Necoro' Neumann1-0/+3
2010-03-23Fixed typo in vim filetypeRené 'Necoro' Neumann1-1/+1
2010-03-23Lighttpd highlightingRené 'Necoro' Neumann2-0/+246
2010-03-16Update python.vim to also highlight "cls"René 'Necoro' Neumann1-1/+3
2010-02-25Defined 'cdu' in terms of 'open_ebuild'René 'Necoro' Neumann2-6/+3
2010-02-25Restricting 'cci' to given files just makes things too complicated. Thus ↵René 'Necoro' Neumann1-10/+11
remove the feature
2010-02-25Enhance error-checking for 'cci'René 'Necoro' Neumann1-2/+24
2010-02-25Small config commit functionRené 'Necoro' Neumann1-0/+35
2010-02-25pass --debug to equery to make it shut up -- also for the 'masked' callRené 'Necoro' Neumann1-1/+1
2010-02-23pass --debug to equery to make it shut upRené 'Necoro' Neumann1-1/+1
2010-02-20Update popups value to the new syntax in vimperator 2.2René 'Necoro' Neumann1-1/+1
2009-12-18Added vim mapping for haskellRené 'Necoro' Neumann1-0/+2