func (r *Runner) Run(hs b.Homeserver, hsURL string) (resErr error) {
	userInstrSets := calculateUserInstructionSets(r, hs)
	var wg sync.WaitGroup
	wg.Add(len(userInstrSets))
	for _, set := range userInstrSets {
		go func(s []instruction) {
			defer wg.Done()
			err := r.runInstructionSet(hs, hsURL, s)
			if err != nil {
				r.log("Instruction set failed: %s", err)
				resErr = err
				r.terminate.Store(true)
			}
		}(set)
	}
	// wait for all users to be made before creating rooms
	wg.Wait()
	if resErr != nil {
		r.log("Terminating: user creation failed: %s", resErr)
		return resErr
	}
	roomInstrSets := calculateRoomInstructionSets(r, hs)
	wg.Add(len(roomInstrSets))
	for _, set := range roomInstrSets {
		go func(s []instruction) {
			defer wg.Done()
			err := r.runInstructionSet(hs, hsURL, s)
			if err != nil {
				r.log("Instruction set failed: %s", err)
				resErr = err
				r.terminate.Store(true)
			}
		}(set)
	}
	// wait for all rooms to be made before returning from this function
	wg.Wait()
	return resErr
}
// Run all instructions until completion. Return an error if there was a problem executing any instruction.
Run all instructions until completion. Return an error if there was a problem executing any instruction.
// Run all instructions until completion . Return an error if there was a problem executing any instruction .
func (r *Runner) Run(hs b.Homeserver, hsURL string) (resErr error) {
	userInstrSets := calculateUserInstructionSets(r, hs)
	var wg sync.WaitGroup
	wg.Add(len(userInstrSets))
	for _, set := range userInstrSets {
		go func(s []instruction) {
			defer wg.Done()
			err := r.runInstructionSet(hs, hsURL, s)
			if err != nil {
				r.log("Instruction set failed: %s", err)
				resErr = err
				r.terminate.Store(true)
			}
		}(set)
	}
	wg.Wait()
	if resErr != nil {
		r.log("Terminating: user creation failed: %s", resErr)
		return resErr
	}
	roomInstrSets := calculateRoomInstructionSets(r, hs)
	wg.Add(len(roomInstrSets))
	for _, set := range roomInstrSets {
		go func(s []instruction) {
			defer wg.Done()
			err := r.runInstructionSet(hs, hsURL, s)
			if err != nil {
				r.log("Instruction set failed: %s", err)
				resErr = err
				r.terminate.Store(true)
			}
		}(set)
	}
	wg.Wait()
	return resErr
}
func ( r * Runner ) Run ( hs b . Homeserver , hsURL string ) ( resErr error ) { userInstrSets := calculateUserInstructionSets ( r , hs ) var wg sync . WaitGroup wg . Add ( len ( userInstrSets ) ) for _ , set := range userInstrSets { go func ( s [ ] instruction ) { defer wg . Done ( ) err := r . runInstructionSet ( hs , hsURL , s ) if err != nil { r . log ( " " , err ) resErr = err r . terminate . Store ( true ) } } ( set ) } wg . Wait ( ) if resErr != nil { r . log ( " " , resErr ) return resErr } roomInstrSets := calculateRoomInstructionSets ( r , hs ) wg . Add ( len ( roomInstrSets ) ) for _ , set := range roomInstrSets { go func ( s [ ] instruction ) { defer wg . Done ( ) err := r . runInstructionSet ( hs , hsURL , s ) if err != nil { r . log ( " " , err ) resErr = err r . terminate . Store ( true ) } } ( set ) } wg . Wait ( ) return resErr }
Run all instructions until completion.
Run all instructions until completion .
// wait for all users to be made before creating rooms // wait for all rooms to be made before returning from this function