mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 05:37:05 +02:00
Reduced code redundancy in import processing
This commit is contained in:
parent
ca3b8492b0
commit
a87686af57
4 changed files with 133 additions and 116 deletions
|
@ -70,12 +70,15 @@ var lovesCmd = &cobra.Command{
|
|||
progress := progressBar(&wg, exportProgress, importProgress)
|
||||
|
||||
// Export from source
|
||||
lovesChan := make(chan models.LovesResult, 1000)
|
||||
go exportBackend.ExportLoves(timestamp, lovesChan, exportProgress)
|
||||
exportChan := make(chan models.LovesResult, 1000)
|
||||
go exportBackend.ExportLoves(timestamp, exportChan, exportProgress)
|
||||
|
||||
// Import into target
|
||||
resultChan := make(chan models.ImportResult)
|
||||
go backends.ProcessLovesImports(importBackend, lovesChan, resultChan, importProgress)
|
||||
var processor = backends.LovesImportProcessor{
|
||||
Backend: importBackend,
|
||||
}
|
||||
go processor.Process(exportChan, resultChan, importProgress)
|
||||
result := <-resultChan
|
||||
close(exportProgress)
|
||||
wg.Wait()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue