merge-requests/4/head
Matthew 2020-06-30 15:03:49 -04:00
parent 00dde49d79
commit 5e022b523a
No known key found for this signature in database
GPG Key ID: 210AF32ADE3B5C4B
1 changed files with 9 additions and 5 deletions

View File

@ -4,13 +4,15 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil"
"os"
"strings"
"time"
"github.com/go-redis/redis/v7" "github.com/go-redis/redis/v7"
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/options"
"io/ioutil"
"strings"
"time"
) )
// RedisClient the Redis client // RedisClient the Redis client
@ -81,12 +83,14 @@ func handler(config ConfigStruct) {
HandleError(err, 0) HandleError(err, 0)
for cur.Next(context.TODO()) { for cur.Next(context.TODO()) {
go checkAccountSizeAndUpdate(cur.Current.Lookup("username").String(), cur.Current.Lookup("id").String()) checkAccountSizeAndUpdate(cur.Current.Lookup("username").String(), cur.Current.Lookup("id").String())
fmt.Printf("Checking account information for %s\n", cur.Current.Lookup("username").String()) fmt.Printf("Checking account information for %s\n", cur.Current.Lookup("username").String())
time.Sleep(600000 * time.Millisecond) time.Sleep(300000 * time.Millisecond)
} }
err = mongoClient.Disconnect(ctx) err = mongoClient.Disconnect(ctx)
HandleError(err, 1) HandleError(err, 1)
fmt.Println("CSD-GO-STR finished, exiting with code 0. [GO]")
os.Exit(0)
} }
func checkAccountSizeAndUpdate(username string, id string) { func checkAccountSizeAndUpdate(username string, id string) {