accounts: add "record count", start searchable user cache
RecordCounter class created from that in activityList, and put in
accountsList. PageCount-type route standardized and made for /users
(/users/count). Created userCache, which regularly generates the
respUser list returned by /users. Added a currently dumb POST /users for
searching/pagination, GET /users is now just for getting -all- users.
go-getted expr, an expression language that seems like it'll be useful
for evaluating local searches. We don't store this data in the badger
DB, so we can't use the nice query form provided by badgerhold.
This commit is contained in:
@@ -15,11 +15,11 @@ import (
|
||||
|
||||
var (
|
||||
names = []string{"Aaron", "Agnes", "Bridget", "Brandon", "Dolly", "Drake", "Elizabeth", "Erika", "Geoff", "Graham", "Haley", "Halsey", "Josie", "John", "Kayleigh", "Luka", "Melissa", "Nasreen", "Paul", "Ross", "Sam", "Talib", "Veronika", "Zaynab"}
|
||||
COUNT = 3000
|
||||
)
|
||||
|
||||
const (
|
||||
PASSWORD = "test"
|
||||
COUNT = 10
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -57,6 +57,12 @@ func main() {
|
||||
password = strings.TrimSuffix(password, "\n")
|
||||
}
|
||||
|
||||
if countEnv := os.Getenv("COUNT"); countEnv != "" {
|
||||
COUNT, _ = strconv.Atoi(countEnv)
|
||||
}
|
||||
|
||||
fmt.Printf("Will generate %d users\n", COUNT)
|
||||
|
||||
jf, err := mediabrowser.NewServer(
|
||||
mediabrowser.JellyfinServer,
|
||||
server,
|
||||
@@ -99,7 +105,7 @@ func main() {
|
||||
|
||||
user, status, err := jf.NewUser(name, PASSWORD)
|
||||
if (status != 200 && status != 201 && status != 204) || err != nil {
|
||||
log.Fatalf("Failed to create user \"%s\" (%d): %+v\n", name, status, err)
|
||||
log.Fatalf("Acc no %d: Failed to create user \"%s\" (%d): %+v\n", i, name, status, err)
|
||||
}
|
||||
|
||||
if rand.Intn(100) > 65 {
|
||||
@@ -112,7 +118,7 @@ func main() {
|
||||
|
||||
status, err = jf.SetPolicy(user.ID, user.Policy)
|
||||
if (status != 200 && status != 201 && status != 204) || err != nil {
|
||||
log.Fatalf("Failed to set policy for user \"%s\" (%d): %+v\n", name, status, err)
|
||||
log.Fatalf("Acc no %d: Failed to set policy for user \"%s\" (%d): %+v\n", i, name, status, err)
|
||||
}
|
||||
|
||||
if rand.Intn(100) > 20 {
|
||||
|
||||
Reference in New Issue
Block a user