Bläddra i källkod

[FIX] sleep time to load correct status

Gogs 7 år sedan
förälder
incheckning
c95c7e34a9
1 ändrade filer med 10 tillägg och 0 borttagningar
  1. 10 0
      api/utils/docker_api.py

+ 10 - 0
api/utils/docker_api.py

@@ -3,6 +3,7 @@ from __future__ import unicode_literals
 from django.conf import settings
 from django.conf import settings
 from docker import DockerClient
 from docker import DockerClient
 from docker.errors import DockerException, NotFound, APIError
 from docker.errors import DockerException, NotFound, APIError
+import time
 
 
 '''
 '''
 '''
 '''
@@ -67,6 +68,9 @@ def start_container(id=None):
     try:
     try:
         container = client.containers.get(id)
         container = client.containers.get(id)
         container.start()
         container.start()
+
+        time.sleep(1)
+
         container.reload()
         container.reload()
 
 
         return {
         return {
@@ -96,6 +100,9 @@ def restart_container(id=None):
     try:
     try:
         container = client.containers.get(id)
         container = client.containers.get(id)
         container.restart()
         container.restart()
+
+        time.sleep(1)
+
         container.reload()
         container.reload()
 
 
         return {
         return {
@@ -125,6 +132,9 @@ def stop_container(id=None):
     try:
     try:
         container = client.containers.get(id)
         container = client.containers.get(id)
         container.stop()
         container.stop()
+
+        time.sleep(1)
+
         container.reload()
         container.reload()
 
 
         return {
         return {