|
@@ -2,24 +2,27 @@ import multiprocessing
|
|
import os
|
|
import os
|
|
|
|
|
|
from robyn import Robyn
|
|
from robyn import Robyn
|
|
|
|
+from robyn.argument_parser import Config
|
|
|
|
|
|
-app = Robyn(__file__)
|
|
|
|
|
|
|
|
|
|
+class SpecialConfig(Config):
|
|
|
|
+ def __init__(self):
|
|
|
|
+ super().__init__()
|
|
|
|
+ self.workers = 2
|
|
|
|
+ self.processes = (os.cpu_count() * 2) + 1
|
|
|
|
+ self.log_level = "WARN"
|
|
|
|
|
|
[email protected]('/plaintext', const=True)
|
|
|
|
-def plaintext() -> str:
|
|
|
|
- return "Hello, world!"
|
|
|
|
|
|
+
|
|
|
|
+app = Robyn(__file__, config=SpecialConfig())
|
|
|
|
|
|
|
|
|
|
-if __name__ == '__main__':
|
|
|
|
- _is_travis = os.environ.get('TRAVIS') == 'true'
|
|
|
|
|
|
[email protected]("/plaintext", const=True)
|
|
|
|
+def plaintext() -> str:
|
|
|
|
+ return "Hello, world!"
|
|
|
|
|
|
- workers = multiprocessing.cpu_count() * 2 + 1
|
|
|
|
- if _is_travis:
|
|
|
|
- workers = 2
|
|
|
|
|
|
|
|
- app.processes = workers
|
|
|
|
- app.add_header("Server", "Robyn")
|
|
|
|
- app.add_header("Content-Type", "text/plain")
|
|
|
|
|
|
+if __name__ == "__main__":
|
|
|
|
+ app.add_response_header("Server", "Robyn")
|
|
|
|
+ app.add_response_header("Content-Type", "text/plain")
|
|
|
|
|
|
app.start(url="0.0.0.0", port=8080)
|
|
app.start(url="0.0.0.0", port=8080)
|