func (s *session) removeParty(p *party) error {
	p.ctx.Infof("session.removeParty(%v)", p)

	// in-memory locked remove:
	lockedRemove := func() {
		s.Lock()
		defer s.Unlock()
		delete(s.parties, p.id)
		s.writer.deleteWriter(string(p.id))
	}
	lockedRemove()

	// remove from the session server (asynchronously)
	storageRemove := func(db rsession.Service) {
		dbSession, err := db.GetSession(s.id)
		if err != nil {
			log.Error(err)
			return
		}
		if dbSession != nil && dbSession.RemoveParty(p.id) {
			db.UpdateSession(rsession.UpdateRequest{
				ID:      dbSession.ID,
				Parties: &dbSession.Parties,
			})
		}
	}
	if s.registry.srv.sessionServer != nil {
		go storageRemove(s.registry.srv.sessionServer)
	}
	return nil
}
// removeParty removes the party from two places:
//   1. from in-memory dictionary inside of this session
//   2. from sessin server's storage
removeParty removes the party from two places:
1. from in-memory dictionary inside of this session
2. from sessin server's storage
// removeParty removes the party from two places : // 1 . from in - memory dictionary inside of this session // 2 . from sessin server ' s storage
func (s *session) removeParty(p *party) error {
	p.ctx.Infof("session.removeParty(%v)", p)
	lockedRemove := func() {
		s.Lock()
		defer s.Unlock()
		delete(s.parties, p.id)
		s.writer.deleteWriter(string(p.id))
	}
	lockedRemove()
	storageRemove := func(db rsession.Service) {
		dbSession, err := db.GetSession(s.id)
		if err != nil {
			log.Error(err)
			return
		}
		if dbSession != nil && dbSession.RemoveParty(p.id) {
			db.UpdateSession(rsession.UpdateRequest{
				ID:      dbSession.ID,
				Parties: &dbSession.Parties,
			})
		}
	}
	if s.registry.srv.sessionServer != nil {
		go storageRemove(s.registry.srv.sessionServer)
	}
	return nil
}
func ( s * session ) removeParty ( p * party ) error { p . ctx . Infof ( " " , p ) lockedRemove := func ( ) { s . Lock ( ) defer s . Unlock ( ) delete ( s . parties , p . id ) s . writer . deleteWriter ( string ( p . id ) ) } lockedRemove ( ) storageRemove := func ( db rsession . Service ) { dbSession , err := db . GetSession ( s . id ) if err != nil { log . Error ( err ) return } if dbSession != nil && dbSession . RemoveParty ( p . id ) { db . UpdateSession ( rsession . UpdateRequest { ID : dbSession . ID , Parties : & dbSession . Parties , } ) } } if s . registry . srv . sessionServer != nil { go storageRemove ( s . registry . srv . sessionServer ) } return nil }
removeParty removes the party from two places:
1. from in-memory dictionary inside of this session
2. from sessin server's storage
removeParty removes the party from two places : 1 . from in - memory dictionary inside of this session 2 . from sessin server ' s storage
// in-memory locked remove: // remove from the session server (asynchronously)