summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd
diff options
context:
space:
mode:
Diffstat (limited to 'src/helsinki.at/rhimportd')
-rw-r--r--src/helsinki.at/rhimportd/main.go33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/helsinki.at/rhimportd/main.go b/src/helsinki.at/rhimportd/main.go
index dee6b37..56fe612 100644
--- a/src/helsinki.at/rhimportd/main.go
+++ b/src/helsinki.at/rhimportd/main.go
@@ -93,36 +93,35 @@ func session_test(conf *rhimport.Config, rddb *rhimport.RdDbChan) {
}
var session *rhimport.SessionChan
- if session, err = store.Get(ctx.UserName, "<test>"); err != nil {
- rhl.Printf("MAIN: (Expected) Error SessionStore.Get(): %s", err)
- }
if session, err = store.Get(ctx.UserName, id); err != nil {
rhl.Printf("MAIN: Error SessionStore.Get(): %s", err)
return
}
- pch := make(chan string, 1000)
- if err = session.AddProgressHandler((chan<- string)(pch), session_test_progress1); err != nil {
- rhl.Printf("MAIN: Error Session.AddProgressHandler(): %s", err)
- }
- dch := make(chan rhimport.ImportResult)
+ dch := make(chan rhimport.ImportResult, 1)
if err = session.AddDoneHandler((chan<- rhimport.ImportResult)(dch), session_test_done); err != nil {
rhl.Printf("MAIN: Error Session.AddDoneHandler(): %s", err)
+ return
}
- rhl.Printf("MAIN: calling run for %s/%s", ctx.UserName, id)
- session.Run()
+ // pch := make(chan string, 10)
+ // if err = session.AddProgressHandler((chan<- string)(pch), session_test_progress1); err != nil {
+ // rhl.Printf("MAIN: Error Session.AddProgressHandler(): %s", err)
+ // }
+ // go func() {
+ // time.Sleep(3 * time.Second)
+ // if err = session.AddProgressHandler((chan<- string)(pch), session_test_progress2); err != nil {
+ // rhl.Printf("MAIN: Error Session.AddProgressHandler(): %s", err)
+ // }
+ // }()
- time.Sleep(500 * time.Millisecond)
-
- if err = session.AddProgressHandler((chan<- string)(pch), session_test_progress2); err != nil {
- rhl.Printf("MAIN: Error Session.AddProgressHandler(): %s", err)
- }
+ rhl.Printf("MAIN: calling run for %s/%s", ctx.UserName, id)
+ session.Run(10 * time.Second)
for {
select {
- case p := <-pch:
- fmt.Println(p)
+ // case p := <-pch:
+ // fmt.Println(p)
case r := <-dch:
fmt.Printf("Import finished: %+v\n", r)
break