def test_stress(self):
        db = PickleShareDB('~/fsdbtest')
        import time, sys
        for i in range(1000):
            for j in range(1000):
                if i % 15 == 0 and i < 200:
                    if str(j) in db:
                        del db[str(j)]
                    continue

                if j % 33 == 0:
                    time.sleep(0.02)

                db[str(j)] = db.get(str(j),
                                    []) + [(i, j, "proc %d" % os.getpid())]
                db.hset('hash', j, db.hget('hash', j, 15) + 1)

            print(i, end=' ')
            sys.stdout.flush()
            if i % 10 == 0:
                db.uncache()
Exemple #2
0
    def test_stress(self):
        db = PickleShareDB("~/fsdbtest")
        import time, sys

        for i in range(1000):
            for j in range(1000):
                if i % 15 == 0 and i < 200:
                    if str(j) in db:
                        del db[str(j)]
                    continue

                if j % 33 == 0:
                    time.sleep(0.02)

                db[str(j)] = db.get(str(j), []) + [(i, j, "proc %d" % os.getpid())]
                db.hset("hash", j, db.hget("hash", j, 15) + 1)

            print(i, end=" ")
            sys.stdout.flush()
            if i % 10 == 0:
                db.uncache()