mirror of
				https://github.com/strapi/strapi.git
				synced 2025-10-31 01:47:13 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			33 lines
		
	
	
		
			651 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			651 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| module.exports = function (rq) {
 | |
|   return new Promise(async (resolve) => {
 | |
|     const ping = async () => {
 | |
|       try {
 | |
|         await rq({
 | |
|           url: '/_health',
 | |
|           method: 'HEAD',
 | |
|           mode: 'no-cors',
 | |
|           json: true,
 | |
|           headers: {
 | |
|             'Content-Type': 'application/json',
 | |
|             'Keep-Alive': false,
 | |
|           }
 | |
|         });
 | |
| 
 | |
|         return resolve();
 | |
|       } catch (err) {
 | |
|         if (err.statusCode) {
 | |
|           return resolve();
 | |
|         } else {
 | |
|           return setTimeout(() => {
 | |
|             ping();
 | |
|           }, 1000);
 | |
|         }
 | |
|       }
 | |
|     };
 | |
| 
 | |
|     setTimeout(() => {
 | |
|       ping();
 | |
|     }, 1000);
 | |
|   });
 | |
| };
 | 
