Issues πΈ Documentation πΈ Releases
β Project Overview
The Sleepy Server
is a simple software testing utility. The server will sleep for the period specified in the incoming request before it responds.
The only API method takes a single parameter:
http(s)://sleepy.server.org/:sleepValue
Where :sleepValue
determines the period that the server will wait before sending a response.
The length of the delay is calculated as the :sleepValue
multiplied by the valueMultiplier
environment variable (which defaults to 1000 - and as such, we can say that the length of the delay is counted in milliseconds)
Use the 'standard' method to launch the Docker Image from the root directory of the project:
docker build -t sleepy:test .
With a :sleepValue
of 5 (and the default multiplyer = 1000)
$ date; time http http://localhost:3000/5 -b; date
Wed Nov 16 09:02:02 CET 2022
Woke up after 5 second(s) of sleep!
... 0.35s user 0.15s system 8% cpu 5.655 total
Wed Nov 16 09:02:08 CET 2022
In your terminal window, the scenario might play out like this:
$ docker run --rm -p 3000:3000 -d sleepy:test
$ docker logs -tf agitated_elemental
2022-11-16T08:00:23.621848495Z Sleeping server listening on port 3000
2022-11-16T08:02:03.494774343Z Going to sleep for 5 second(s)!
2022-11-16T08:02:08.498342553Z Wake up! 5 second(s) passed.
Simultaneous Requests:
$ date; for I in $(seq 5 -2 1); do \
((http GET http://localhost:3000/$I -b | cat - && echo -n ' -- ' && date) &) \
done
Wed Nov 16 09:03:47 CET 2022
Woke up after 1 second(s) of sleep! -- Wed Nov 16 09:03:48 CET 2022
Woke up after 3 second(s) of sleep! -- Wed Nov 16 09:03:50 CET 2022
Woke up after 5 second(s) of sleep! -- Wed Nov 16 09:03:52 CET 2022
And in the server logs:
2022-11-16T08:03:47.917399749Z Going to sleep for 5 second(s)!
2022-11-16T08:03:47.923730533Z Going to sleep for 1 second(s)!
2022-11-16T08:03:47.924537943Z Going to sleep for 3 second(s)!
2022-11-16T08:03:48.925443668Z Wake up! 1 second(s) passed.
2022-11-16T08:03:50.925969532Z Wake up! 3 second(s) passed.
2022-11-16T08:03:52.918711537Z Wake up! 5 second(s) passed.
port
- the port on the server will be listening onvalueMultiplier
- the multiplier of:sleepValue
which is used to calculate the length of the delay before the server responds. Leaving this value set to the default of 1000 makes:sleepValue
roughly equal to a number of seconds.
πͺ Available Support
β€οΈ Project Supporters
π§ Author / Maintainer
π Security
While I always good security practices, 100% security can never be guaranteed in any software package. The Sleepy Server
is provided AS IS, and without warranty. You can find more details in the LICENSE file included with this repository.
If you discover any issue regarding the security of this project, please disclose that information responsibly by sending a security advisory. PLEASE DO NOT CREATE AN ISSUE OR DISCUSSION TOPIC. You can read more about this project's security policies HERE
Β©οΈ Copyright & Attributions
This project incorporates ideas and / or code crafted by the following talented individuals:
- lbacik/sleeping-server
Copyright (C) 2017 Lukasz Bacik <[email protected]>
GPL Licensed
"We see much further, and reach much higher,
only because we stand upon the shoulders of giants"
βοΈ License
Copyright Β© 2023 Darren (Ragdata) Poulton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.