Adding/Remove Users from a Roster Via Scripting

I am creating a custom roster manager and I ran into an issue where after I add or remove a user the roster doesn't update right away. It seems to take a few seconds to pick up the roster change. I didn't want the user to have to click a refresh after adding or removing a user so my solution was to put a invokeAsynchronous and a 2 second sleep timer before I fetch the updated roster. This seems to work every time.

  1. Why doesn't the roster update right away
  2. Is there a better way to do this

REMOVE BUTTON user hardcoded for now

    import time
	
	#Disable Button so user can't click it twice
	self.view.custom.buttonsEnabled = False
	
	#Get user and roster name
	user = system.user.getUser('ActiveDirectory', 'USER')
	roster = self.view.params.Roster
	
	#Remove user from roster
	system.roster.removeUsers(roster, [user])
	
	#Added a delayed refresh because after adding or remove a user on a roster it takes a few seconds to pick up the change
	#Only using time.sleep because I am calling it Asynchronous
	def delay_refresh():
		time.sleep(2)
        #Get updated roster contains system.roster.getUsers(name)
		self.view.custom.roster = custom.roster.get(roster)
		self.view.custom.buttonsEnabled = True
		
	system.util.invokeAsynchronous(delay_refresh)

What version of Ignition are you using?

This should be fixed in 8.3.6.

We are on 8.3.3. Good to know it will be fixed on 8.3.6. I know our server admin was planning to upgrade soon.

Thanks,