From b4377b2f54ae06403cb978f5084e0b271de4be6c Mon Sep 17 00:00:00 2001 From: Oleg Silkin Date: Tue, 7 Apr 2020 16:16:34 -0400 Subject: [PATCH] Cleans up & adds todos for future --- scripts/stress_test.py | 84 ------------------------------------- scripts/valid_signatures.py | 3 +- src/database/writes.py | 1 + src/main.py | 1 - 4 files changed, 3 insertions(+), 86 deletions(-) delete mode 100644 scripts/stress_test.py diff --git a/scripts/stress_test.py b/scripts/stress_test.py deleted file mode 100644 index 6022396..0000000 --- a/scripts/stress_test.py +++ /dev/null @@ -1,84 +0,0 @@ -import sqlite3 -import time - -import faker -from faker.providers import misc - -fake = faker.Faker() -fake.add_provider(misc) - - -if __name__ == '__main__': - song_time = """One, two, three! -My baby don't mess around -'Cause she loves me so -This I know fo sho! -But does she really wanna -But can't stand to see me walk out tha door -Don't try to fight the feeling -Because the thought alone is killin' me right now -Thank God for Mom and Dad -For sticking to together -Like we don't know how -Hey ya! Hey ya! -Hey ya! Hey ya! -Hey ya! Hey ya! -Hey ya! Hey ya! -You think you've got it -Oh, you think you've got it -But got it just don't get it when there's nothin' at all -We get together -Oh, we get together -But separate's always better when there's feelings involved -Know what they say -its -Nothing lasts forever! -Then what makes it, then what makes it -Then what makes it, then what makes it -Then what makes love the exception? -So why, oh, why, oh -Why, oh, why, oh, why, oh -Are we still in denial when we know we're not happy here -Hey ya! (y'all don't want to here me, ya just want to dance) Hey ya! -Don't want to meet your daddy (oh ohh), just want you in my caddy (oh ohh) -Hey ya! (oh, oh!) Hey ya! (oh, oh!) -Don't want to meet your momma, just want to make you cum-a (oh, oh!) -I'm (oh, oh) I'm (oh, oh) I'm just being honest! (oh, oh) -I'm just being honest! -Hey! alright now! alright now, fellas! -Yea? -Now, what cooler than being cool? -Ice cold! -I can't hear ya! I say what's, what's cooler than being cool? -Ice cold! -Alright alright alright alright alright alright alright alright alright alright alright alright alright alright alright alright! -Okay, now ladies! -Yea? -Now we gonna break this thang down for just a few seconds -Now don't have me break this thang down for nothin' -I want to see you on your badest behavior! -Lend me some sugar, I am your neighbor! -Ah! Here we go now, -Shake it, shake it, shake it, shake it, shake it -Shake it, shake it, shake it, shake it -Shake it like a Polaroid picture! Hey ya! -Shake it, shake it, shake it, shake it, shake it -Shake it, shake it, shake it, suga! -Shake it like a Polaroid picture! -Now all the Beyonce's, and Lucy Lu's, and baby dolls -Get on tha floor get on tha floor! -Shake it like a Polaroid picture! -Oh, you! oh, you! -Hey ya!(oh, oh) Hey ya!(oh, oh) -Hey ya!(oh, oh) Hey ya!(oh, oh) -Hey ya!(oh, oh) Hey ya!(oh, oh)""" - - song = song_time.split('\n') - claim_id = '2aa106927b733e2602ffb565efaccc78c2ed89df' - run_len = [(fake.sha256(), song_time, claim_id, str(int(time.time()))) for k in range(5000)] - - conn = sqlite3.connect('database/default_test.db') - with conn: - curs = conn.executemany(""" - INSERT INTO COMMENT(CommentId, Body, LbryClaimId, Timestamp) VALUES (?, ?, ?, ?) - """, run_len) - print(f'rows changed: {curs.rowcount}') diff --git a/scripts/valid_signatures.py b/scripts/valid_signatures.py index 19fc878..4b7c641 100644 --- a/scripts/valid_signatures.py +++ b/scripts/valid_signatures.py @@ -2,11 +2,12 @@ import binascii import logging import hashlib import json +# todo: remove sqlite3 as a dependency import sqlite3 import asyncio import aiohttp -from server.validation import is_signature_valid, get_encoded_signature +from src.server.validation import is_signature_valid, get_encoded_signature logger = logging.getLogger(__name__) diff --git a/src/database/writes.py b/src/database/writes.py index 61caa78..b86e31b 100644 --- a/src/database/writes.py +++ b/src/database/writes.py @@ -1,3 +1,4 @@ +# TODO: scrap notification routines from these files & supply them in handles import logging import sqlite3 from asyncio import coroutine diff --git a/src/main.py b/src/main.py index 817dac4..d4b5a53 100644 --- a/src/main.py +++ b/src/main.py @@ -1,5 +1,4 @@ import argparse -import json import yaml import logging import logging.config