Update 'client/puller/chats.go'
This commit is contained in:
		
							parent
							
								
									39fcba4d7b
								
							
						
					
					
						commit
						72af8a536b
					
				
					 1 changed files with 3 additions and 10 deletions
				
			
		|  | @ -10,16 +10,14 @@ func Chats(tdlibClient *client.Client) (chan *client.Chat, chan error) { | |||
| 	chatChan := make(chan *client.Chat, 10) | ||||
| 	errChan := make(chan error, 1) | ||||
| 
 | ||||
| 	var offsetOrder client.JsonInt64 = math.MaxInt64 | ||||
| 	var offsetChatId int64 = 0 | ||||
| 	var limit int32 = 100 | ||||
| 
 | ||||
| 	go chats(tdlibClient, chatChan, errChan, offsetOrder, offsetChatId, limit) | ||||
| 	go chats(tdlibClient, chatChan, errChan, limit) | ||||
| 
 | ||||
| 	return chatChan, errChan | ||||
| } | ||||
| 
 | ||||
| func chats(tdlibClient *client.Client, chatChan chan *client.Chat, errChan chan error, offsetOrder client.JsonInt64, offsetChatId int64, limit int32) { | ||||
| func chats(tdlibClient *client.Client, chatChan chan *client.Chat, errChan chan error, limit int32) { | ||||
| 	defer func() { | ||||
| 		close(chatChan) | ||||
| 		close(errChan) | ||||
|  | @ -27,9 +25,7 @@ func chats(tdlibClient *client.Client, chatChan chan *client.Chat, errChan chan | |||
| 
 | ||||
| 	for { | ||||
| 		chats, err := tdlibClient.GetChats(&client.GetChatsRequest{ | ||||
| 			OffsetOrder:  offsetOrder, | ||||
| 			OffsetChatId: offsetChatId, | ||||
| 			Limit:        limit, | ||||
| 			Limit: limit, | ||||
| 		}) | ||||
| 		if err != nil { | ||||
| 			errChan <- err | ||||
|  | @ -53,9 +49,6 @@ func chats(tdlibClient *client.Client, chatChan chan *client.Chat, errChan chan | |||
| 				return | ||||
| 			} | ||||
| 
 | ||||
| 			offsetOrder = chat.Order | ||||
| 			offsetChatId = chat.Id | ||||
| 
 | ||||
| 			chatChan <- chat | ||||
| 		} | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue