Merge pull request #16 from Selly-Modules/develop

rerun
This commit is contained in:
Minh Nguyen 2022-03-25 15:27:56 +07:00 committed by GitHub
commit 2bc3affefb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 7 deletions

View File

@ -1,7 +1,6 @@
package appier package appier
import ( import (
"context"
"fmt" "fmt"
"github.com/Selly-Modules/redisdb" "github.com/Selly-Modules/redisdb"
@ -34,25 +33,30 @@ func (s SyncToService) syncData() {
// handleSyncDataToServiceAppier ... // handleSyncDataToServiceAppier ...
func handleSyncDataToServiceAppier(pattern string, typeData string) { func handleSyncDataToServiceAppier(pattern string, typeData string) {
fmt.Println("keyProductPattern", pattern)
for { for {
keys, values := redisdb.GetWithPrefixPattern(pattern) keys, values := redisdb.GetWithPrefixPattern(pattern)
if len(keys) == 0 { if len(keys) == 0 {
fmt.Println("No keys data")
return
}
if len(values) == 0 {
fmt.Println("No values DATA")
return return
} }
processSyncToServiceAppier(typeData, values) processSyncToServiceAppier(typeData, values)
// Del keys //// Del keys
for _, key := range keys { //for _, key := range keys {
redisdb.DelKey(context.Background(), key) // redisdb.DelKey(context.Background(), key)
} //}
} }
} }
// processSyncToServiceAppier ... // processSyncToServiceAppier ...
func processSyncToServiceAppier(typeData string, values []string) { func processSyncToServiceAppier(typeData string, values []string) {
fmt.Println("Sends")
for { for {
if len(values) <= 20 { if len(values) <= 20 {
syncDataByList(typeData, values) syncDataByList(typeData, values)