How do you safely update your app

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?

Wondering how everyone else handles it?

Thanks

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.

Could you elaborate a bit. What do you mean you can update it with a mouse click, you’re referring to the session count correct.

In playing around why is it that it shows three sessions when I know there’s only one. Then after a little while in session count goes down.

So if the session count shows one it’s OK then to update the app correct?

Yes

It can take up to 3 minutes for a session to disappear after that session’s browser tab closes.

No. Read up on this here: http://www.1701software.com/blog/2013/09/08/upgrading-xojo-cgi-apps

Does this work on Xojo cloud?

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 use serverwarp.com for Xojo hosting.

It should.

@Greg O’Lone

I deleted the cgi and it still runs.

So this method will not work.

However if you delete the index.cgi it works, but it will close down any current session.

So @Greg O’Lone what’s the safest way to update an app on Xojo Cloud?

@Greg O’Lone

Any suggestions?

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.

I deleted the cgi and it still runs.
New sessions can be launched in XC.

So this method will not work.

However if you delete the index.cgi it will close down any all session immediately.

So I don’t see how to implement this on XC.

[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.

Also, I assume you are deleting the CGI file in that particular app’s folder.

If you delete the cgi, people can still launch it. If you delete the index.cgi, all sessions terminate instantly.

Never put in app with timer based on my experiments.

[quote=461333:@Richard Albrecht]If you delete the cgi, people can still launch it. If you delete the index.cgi, all sessions terminate instantly.

Never put in app with timer based on my experiments.[/quote]
Then you haven’t tried the method suggested, which never fails me.

What I’m saying is if you delete the appname.cg You can still launch the application. So that doesn’t 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.

Very frustrating!

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).

XC is differant. Apps are noot launched with the cgi in the url. It’s just the folder name.

If you delete the cgi, you can still launch the app.

There is an index.cgi also. If you delete that it shuts down all sessions. So it doesn’t work the same as on other servers.

If you would like to write a test app I can deploy it as an experiment.

@Greg O’Lone

Any input for us mere mortals?