Skip to content

Commit

Permalink
Higher upload size
Browse files Browse the repository at this point in the history
  • Loading branch information
Ketok4321 committed Aug 16, 2023
1 parent 48385c8 commit 435939c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def on_start_action(self, widget, _):
self.worker.start()

def on_back_action(self, widget, _):
self.worker.stop_event.set() # TODO: wait for the thread to stop?
self.worker.stop_event.set()

self.win.view_switcher.set_visible_child(self.win.start_view)
self.win.back_button.set_visible(False)
Expand Down
9 changes: 4 additions & 5 deletions src/speedtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

from urllib.parse import urljoin

CHUNK_SIZE = 100 # in MB
UPLOAD_SIZE = 1024 # in KiB
DOWNLOAD_SIZE = 100
UPLOAD_SIZE = 10
REQUEST_COUNT = 3
DURATION = 15

Expand All @@ -16,7 +16,7 @@
"User-Agent": "ketok-speedtest/dev",
}

garbage = os.urandom(UPLOAD_SIZE * 1024)
garbage = os.urandom(UPLOAD_SIZE * 1000 * 1000)

class Server:
def __init__(self, name, server, pingURL, dlURL, ulURL, **_):
Expand Down Expand Up @@ -104,10 +104,9 @@ async def ping(server): #TODO: jitter and other stuff
return sum(pings) / len(pings) * 1000

async def download(server, total):
print(server.downloadURL)
async with aiohttp.ClientSession() as session:
while True:
async with session.get(server.downloadURL + "?ckSize=" + str(CHUNK_SIZE), headers=HEADERS) as response:
async with session.get(server.downloadURL + "?ckSize=" + str(DOWNLOAD_SIZE), headers=HEADERS) as response:
async for data in response.content.iter_any():
total[0] += len(data)

Expand Down

0 comments on commit 435939c

Please sign in to comment.