Script is stuck the the first Update-RDMUI

Script is stuck the the first Update-RDMUI

avatar

Hello

I use the newest Versions of RDM and PS Module.

When I run my Script:
$datasource = Get-RDMDataSource -Name 'MyDB'
Set-RDMCurrentDataSource $datasource
Update-RDMUI
Get-RDMCurrentDataSource

The script will be stuck at Update-RDM in this screen.
forum image
The Local Data Source is the default data source in my RDM.

I can run it without this command but I think it's not recomended.

Best regards
Rolf

All Comments (8)

avatar

Hi Rolf,

Is RDM running when you execute your script?

You can safely remove this call to Update-RDMUI.
Update-RDMUI is used to reload the repository and connection list. You can achieve the same result by calling Set-RDMSession with the -Refresh flag.
Update-RDMUI is useful if you want to add a batch of entries that don't need to know about each other.

That being said, calling Update-RDMUI after Set-RDMCurrentDataSource should work so we'll have to figure out what's wrong.

Regards

Jonathan Lafontaine

avatar

Hi Jonathan

It does not matter if RDM is running or not. But most of the times its closed.

The thing is I can't call Update-RDMUI at all. As soon as I reach this line the script will be stuck. Unfortunately I cant remove all of it.

Best regards
Rolf

avatar

Update-RDMUI tries to call RDM over TCP on the loopback address.
Normally, RDM is either running and the connection is near instant, it RDM isn't and the connection fails almost as quick.

I'll have to figure out why it seems to get stuck waiting for a connection in your case.

Jonathan Lafontaine

avatar

Hello

Today at 3:30 am here the daily update was stuck aswell.
But now its works again...
I really dont know whats going on here.

Best regards
Rolf

avatar

Do you care at all if RDM connection's list updates whenever the PowerShell module does something?
It made more sense with the old module but not so much anymore.
I could separate the two functionalities, refreshing the module's sessions and updating the RDM UI.
Assuming calling RDM is where the script get stuck, that would solve your issue and possibly speed it up a bit.

Jonathan Lafontaine

avatar

Hi

I think i dont care. The main point is that it works.
So if I get you right, the "-Refresh" command after a "Set-RDMSession" does the same and is better?
You have any best pratice guide for using the PS Module?

I will remove the Update-RDMUI commands in future but we have like 12 script with a few hundred lines of code each and 5 cmdlets for daily updates and all of them are using the Update-RDMUI command. My boss have to give me time for that. I also need to reorganize the scripts from scratch of.

Rolf

avatar

It's not better, it does the same thing, just at different times.
Ideally, we could find a solution that doesn't involve you modifying a few hundred lines of code.

One way, if you are comfortable with it, could be a personalized build that removes the calls to RDM from Update-RDMUI.
I would still separate the functionality in the official module but that should give you a working solution and more time to adapt your script.

Jonathan Lafontaine

avatar

Ah ok thanks.

No, its fine. Thank you very much :)
My code is a total mess and I need to clean it up anyways. I just wanted to say that this may take a while to replace the Update-RDMUI commands, time that I dont have now.

In short:
I cant remove it now. I will remove it sooner or later. You dont have to make a special version for me. And thank you very much for your time and clarification about the use of the commands and how they work.

Best regards
Rolf