package main

import (
	"log"
	"time"
)

func main() {
	log.Println("[background-worker] started")

	tickerRMV := time.NewTicker(5 * time.Minute)
	tickerRSS := time.NewTicker(1 * time.Minute)
	tickerMarket := time.NewTicker(10 * time.Second)
	defer tickerRMV.Stop()
	defer tickerRSS.Stop()
	defer tickerMarket.Stop()

	rmv_request()
	fetchMarketData()
	fetchRSSFeeds()

	for {
		select {
		case <-tickerRMV.C:
			go rmv_request()
		case <-tickerRSS.C:
			go fetchRSSFeeds()
		case <-tickerMarket.C:
			go fetchMarketData()
		}

	}
}
