mirror of
https://github.com/jpetazzo/container.training.git
synced 2026-07-29 01:31:11 +00:00
add delay in hasher and rng
This commit is contained in:
@@ -6,6 +6,8 @@ set :bind, '0.0.0.0'
|
||||
set :port, 80
|
||||
|
||||
post '/' do
|
||||
# Simulate a bit of delay
|
||||
sleep 0.1
|
||||
content_type 'text/plain'
|
||||
"#{Digest::SHA2.new().update(request.body.read)}"
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from flask import Flask, Response
|
||||
import os
|
||||
import socket
|
||||
import time
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@@ -19,6 +20,8 @@ def index():
|
||||
|
||||
@app.route("/<int:how_many_bytes>")
|
||||
def rng(how_many_bytes):
|
||||
# Simulate a little bit of delay
|
||||
time.sleep(0.1)
|
||||
return Response(
|
||||
os.read(urandom, how_many_bytes),
|
||||
content_type="application/octet-stream")
|
||||
|
||||
Reference in New Issue
Block a user