mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-25 05:47:57 +02:00
Run exporter in goroutine
Use channel to pass data from exporter to importer
This commit is contained in:
parent
1ba165a631
commit
298697dcfc
7 changed files with 124 additions and 42 deletions
|
@ -61,9 +61,8 @@ var listensCmd = &cobra.Command{
|
|||
fmt.Printf("From timestamp: %v (%v)\n", timestamp, timestamp.Unix())
|
||||
|
||||
// Export from source
|
||||
listens, err := exportBackend.ExportListens(timestamp)
|
||||
cobra.CheckErr(err)
|
||||
fmt.Printf("Loaded %v listens from %v.\n", len(listens), sourceName)
|
||||
listens := make(chan models.ListensResult, 1000)
|
||||
go exportBackend.ExportListens(timestamp, listens)
|
||||
|
||||
// Import into target
|
||||
result, err := importBackend.ImportListens(listens, timestamp)
|
||||
|
|
|
@ -61,9 +61,8 @@ var lovesCmd = &cobra.Command{
|
|||
fmt.Printf("From timestamp: %v (%v)\n", timestamp, timestamp.Unix())
|
||||
|
||||
// Export from source
|
||||
loves, err := exportBackend.ExportLoves(timestamp)
|
||||
cobra.CheckErr(err)
|
||||
fmt.Printf("Loaded %v loves from %v.\n", len(loves), sourceName)
|
||||
loves := make(chan models.LovesResult, 1000)
|
||||
go exportBackend.ExportLoves(timestamp, loves)
|
||||
|
||||
// Import into target
|
||||
result, err := importBackend.ImportLoves(loves, timestamp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue