What is the safest way to update an app you have running on Xojo Cloud? I thought the Stats window showed the number of sessions for the selected app. It does not. There should be a way for Xojo to supply us with accurate information on what apps are running.
In the docs it show SessionCount and gives this example:
For i As Integer = 0 To App.SessionCount - 1
App.SessionAtIndex(i).MsgBox("App shutdown.")
Next
This makes no sense to me, what does it do? I ran it in the debugger
Session count does show the number of sessions, but am I to understand we have to put a secret function that can be called with a special click on page with modifier keys to show?
Isn’t it possible to build an app that can show you how many session for each app you have running?
My AdminPage for any Web app has a ReadOnly WebTextField that displays Str(App.SessionCount). It has two event handlers (Shown and MouseUp) with the following Action:
Me.Text = Str(App.SessionCount)
That way I can update it with just a mouse click on it.
I don’t use Xojo Cloud. The whole point here is to make sure that your CGI app is not running at all when you attempt to update it. The timer mentioned in that article makes sure that the app is not running within 5 seconds after you either delete or rename the CGI file itself. Then you update your CGI app with fresh files and go from there. I don’t know how Xojo Cloud works, so can’t help you with this. Maybe someone else here can.
I assume you re-coded your app so that it has the App.Timer in question. However, if you were not sure that all instances of the prior version of that app were NOT running BEFORE you uploaded the new code, then the old instance is probably still running without the App.Timer. In that case, deleting the CGI file will not stop all instances of the app. You need to make sure no instance of the app is running before updating it with new files. After you do that, and then update your Web files with the version of the app that has the App.Timer, making sure no instance of the app is running is simple: either delete or rename the CGI file. After you wait the requisite amount of seconds, you can be sure no instance of the app is running and can then update it if needed.
[quote=461253:@Richard Albrecht]I deleted the cgi and it still runs.
New sessions can be launched in XC.[/quote]
Then a version of that app was running that didn’t have the App.Timer code, so it didn’t die when you deleted the CGI file. Otherwise, the app would not have have started when the next user attempted to hit it. How could it if its CGI file is missing.
If what I’m saying makes sense, you need to come up with a way, for now, to stop all instances of the app (not just its sessions). Then update the app with the new files that have the App.Timer. After you do that, you can stop all instances of the app by just renaming or deleting its CGI file.
What Im saying is if you delete the appname.cg You can still launch the application. So that doesnt stop new sessions like on a non xc server. There is an index.cgi also, and if you delete that all instances of the app shut down immediately. Xojo cloud seems to be a different animal.
What you’re not getting is that the App.Timer will shutdown the App, not just its Sessions, when the CGI file disappears. Once that App is shutdown and the CGI is missing, nobody can start it. The reason you see new new Sessions being created even though you delete the CGI file, is because the App is running.
Actually, Richard, now that I think of it, tell me how you are having your users load that Web app. The URL address they should be using should end with the CGI file reference, like this:
myserver.com/cgi-bin/MyWebApp/mywebapp.cgi
If they attempt to load that app when the CGI file is missing, they would get an Error 400 (or something similar).