mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	analytics/management/commands/check_analytics_state.py: Avoid shelling out for mv.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							f3b0b8edc8
						
					
				
				
					commit
					8d52f0e0c0
				
			@@ -12,7 +12,6 @@ from zerver.lib.timestamp import floor_to_hour, floor_to_day, verify_UTC, \
 | 
			
		||||
from zerver.models import Realm
 | 
			
		||||
 | 
			
		||||
import os
 | 
			
		||||
import subprocess
 | 
			
		||||
import sys
 | 
			
		||||
import time
 | 
			
		||||
from typing import Any, Dict
 | 
			
		||||
@@ -40,7 +39,7 @@ class Command(BaseCommand):
 | 
			
		||||
        with open(state_file_tmp, "w") as f:
 | 
			
		||||
            f.write("%s|%s|%s|%s\n" % (
 | 
			
		||||
                int(time.time()), status, states[status], message))
 | 
			
		||||
        subprocess.check_call(["mv", state_file_tmp, state_file_path])
 | 
			
		||||
        os.rename(state_file_tmp, state_file_path)
 | 
			
		||||
 | 
			
		||||
    def get_fill_state(self) -> Dict[str, Any]:
 | 
			
		||||
        if not Realm.objects.exists():
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user