Model publishing starts after 8 hours after C4R command executing - autodesk-forge

I've implemented a service, that publish all models, which were modified with C4R. I've used tutorial on the Forge site.
Sometimes, when i execute command for publishing models, it returns status:commited, but it starts to publish after 7-8 hours.
As my models are big, it takes 3-4 hours to publish it, so i receive webhook after 12 hours after execution of the command.
How to fix that? Is there some publishing queue or something else to look into?

Forge web services, like most web services, have a job queuing system. At busy times your job may take extra time to start. Or, based on external dependencies, it may need to wait for some other job to finish.
That said, when you post to publish endpoint, check the response, it should contain a request-id header that we can use to track down what's happening. Please share that so I can check our logs.
UPDATE
The system will not emit a publish completed event, your application should watch for dm.version.added instead. Looking at your specific request, there is nothing unexpected, just note that publishing can take a long time depending on the number of models, size of models and the length of the publishing queue.

Related

IBM Maximo - Querying API for data with very slow response time

I have been looking everywhere for a solution to this problem.
At my work, we are trying to integrate Maximo with another system via the other systems REST API (which returns JSON responses). I am able to make this integration work on a small scale, however this API is taking upwards of 5 seconds to respond per request. Currently, I have defined this system as a JSON Resource, and I copy daily "snapshots" of the non-persistent data to a persistent attribute using an automation script. The requests all run in a sequence - which works slowly for 5 assets in testing, and will definitely not scale to 1000's of calls a day.
Assume that the API of the external system cannot be modified in any way... Is there a way to query this API in a non-blocking way? I'd imagine that if I could send a request, and send the next, etc. without needing to wait for a reply to proceed, this would solve the problem.
I looked into Invocation and Publishing Channels, and also Enterprise Services, and it seems like Enterprise Services along with JMS Queues might be what I need, however documentation says that these only support queuing incoming data... and I can't see how this solves my problem.
Any help? I am completely stuck on this.
Thank you!
I had to do something that sounds similar, once. I tried JSON Resources, but they didn't work for me. I ended up using the examples in Maximo 7.6 Scripting Features to do it. The first code sample in that document is a library script for making HTTP/S calls using out-of-the-Maximo-box libraries, and other examples in that document use IBM's JSONObject and JSONArray classes (also available out of the Maximo box) to parse responses.
To get things going concurrently / multithreaded, you could configure a cron task to call your automation script, and configure multiple instances on various schedules to call the same one and use the args or some other mechanism to prevent collisions.

Any known limits to calls per minute for webapps?

Im getting inconsistent behaviours when sending POST requests to a google apps script deployed as webapp.
I have a desktop app sending POST calls to a GAS webapp. This calls may be totally variable in their cadence, from 1 in several minutes, to bursts of dozens per second.
In my tests I have found requests seemingly lost, requests that don't progress along the webapp internal logic flow (like script instances that get cut or interrupeted (?)), while others work flawlessly. There is no evident pattern.
However, trying things around, I found that if I space the calls, adding a pause between requests, everything normalizes.
Are there stablished and known limits for this? The only option I have to solve this is to introduce this artificial intervals between calls? I have not found information on this in the GAS quotas page.
Any help and ideas would be appreciated.
Confirming in the answer: there is no evident or documented per-minute limit on the number of requests to a GAS webapp.
The issue I'm experimenting is related to concurrency. Even when they are coming from the same source, fast paced requests can produce concurrency issues when accesing storage services like Cache or Properties.
This should be handled using the Lock Service.

Mvvmcross Subscription message firing stalls for 20+ secs after first viewmodel is shown

In some of my my viewmodels and some background running services, I need a second tick for all sorts of actions such as Statemachine progression etc..
To avoid having to create a Timer for every occasion, I have one TimerService which publishes a Messenger plugin message every second.
Those viewmodels or Services that need it just subscribe to this message.
This has worked well for over a year. Recently I noticed a rather long startup time of my app. After some debugging I found that after the launch of the first Viewmodel (it is correctly displayed), it takes about 25secs before the subscriptions start picking up on this message. Seems like something is holding back the publishing of these messages.
During those 20+ secs there is no activity by MvvmCross at all. Nothing is logged by Mvvmcross at all.
What could cause such behaviour ? When in the startup sequence does the messenger plugin start distributing its messages ?
I apologise for not posting code here, as it is a phenomenon that is just happening across the whole application. None of the singleton services that run in the background pick up these messages until after 20secs everything starts working properly.
EDIT: MvvmCross V3.5 is used along with latests stable updates of Xamarin. Problem occurs on every Android version tested.
After some experimenting (and reading all the MvxMessenger docs again) I tried using the SubscribeOnThreadPoolThread method instead of simple subscribe for one of the published messages that typically triggers updating the properties of a viewmodel on a regular basis in its handlers. This made the problem go away.
Normally the handling if this viewrefresh message is fast and doesn't require more then copying repository values (that are updated by a background service) to the visible viewmodel properties. I guess there's somewhere a synchronous call in one of the refresh handlers that make the messenger system block.Haven't found it yet.
What are typical situations that can make the Messenger plugin block ? I would be very interested to understand that a little better.

openshift application goes idle and halts its cron jobs

I use openshift to run a script from time to time with the cron cartridge.
however, as my application has no web activity (yet) it goes idle and my process doesn't run.
one could think of an ugly solution to generate fake web-load by using another service (such as ifttt to retrieve a page constantly but this sounds wrong.
could there be a better solution?
apparently the only way is to trick openshift to have out-coming traffic, I used a free account of https://www.site24x7.com for that
OpenShift will idle your application after 24 hours of inactivity1, but you can add an hourly cron job to your app to keep itself alive.
.openshift/cron/hourly/ping.sh
#!/bin/bash
PATH=/bin:/usr/bin:/usr/sbin
app_url=http://$OPENSHIFT_APP_DNS/
curl --insecure --location --silent --fail "$app_url" >/dev/null
Assuming your app isn't already idled and won't run the cron job :-)
1 Apparently the idle period used to be 48 hours before, but now it is 24 hours according to the OpenShift pricing table. In other words, a daily pinger cron job won't do it for you.
Openshift cartridge goes idle after 24 hours of inactivity.
Activity is considered receiving a Get request in your application originated outside your cartridge (so pinging your app from your own cartridge doesn’t work).
You can use any free pinging service to ping your application after a specific interval of time(< 24hrs).
You may use Pingdom. I have found success using it. It provides a nice dashboard and graphs of response time as well. You will be notified if there is any issues connecting to your app or if its down. You can manage your account with their mobile apps.
There are other free pinging services too. Feel free to Google and try out other services. Do comment if you find a good one, might be a great help for some :-).
It's not really a "trick" per se, but as long as you have consistent incoming traffic, your gear will not idle.
Bronze is free. All plans retain the free stuff, e.g. 3 free gears etc. you will only pay $0.02 hr on gears above 3.
So if you are using the free tear and not using 3 gears you should be safe to upgrade to bronze and remain free.
In your nodejs app:
Create an httpserver able to dispatch a get request page
Include a cron job into your array job list that every hour send a post to external page (php,jsp or every kind of "page" that can create a curl request).
In external page:
Execute the logic of a job (optional because you can use job2, job3..jobn and leave this job just for hold your app awake)
Insert somewhere in the code a request back to nodejs server page using php curl library.
In this case:
At every hour, idle timeout will be reset and your application stay awake
You can decide to put jobs in external pages and/or nodejs
Hope it helps someone.
EDIT: I'm sorry, it's not working anymore. No matter which kind of strategy you use, they will be able to discover systematic requests coming from a specific IP and exclude this situation, bringing your app idle for earn money, because everybody know that BRONZE is not FREE. It costs at least 0.02$/hour.

What's the best way to notify a non-web application about a change on a web page?

Let's say I have two applications which have to work together to a certain extent.
A web application (PHP, Ruby on Rails, ...)
A desktop application (Java, C++, ...)
The desktop application has to be notified from the web application and the delay between sending and receiving the notification must be short. (< 10 seconds)
What are possible ways to do this? I can think of polling in a 10 second interval, but that would produce much traffic if many desktop applications have to be notified. On a LAN I'd use an UDP broadcast, but unfortunately that's not possible here...
I appreciate any ideas you could give me.
I think the "best practice" here will depend on the number of desktop clients you expect to serve. If there's just one desktop to be notified, then polling may well be a fine approach -- yes, polling is much more overhead than an event-based notification, but it'll certainly be the easiest solution to implement.
If the overhead of polling is truly unacceptable, then I see two basic alternatives:
Keep a persistent connection open between the desktop and web-server (could be a "comet"-style web request, or a raw socket connection)
Expose a service from within the desktop app, and register the address of the service with the web-server. This way, the web-server can call out to the desktop as needed.
Be warned, though -- both alternatives are chock full of gotchas. A few highlights:
Keeping a connection open can be tricky, since you want your web-servers to be hot-swappable
Calling out to an external service (eg, your desktop) from a web-server is dangerous, because this request could hang. You'd want move this notification onto a separate thread to avoid tying up the webserver.
To mitigate some of the concerns, you might decouple the unreliable desktop from the web-server by introducing an intermediary notification server -- the web-server could post an update somewhere, and the desktop could poll/connect/register there to be notified. To avoid reinventing the wheel here, this could involve some sort of MessageQueue system... This, of course, adds the complexity of needing to maintain the new intermediary.
Again, all of these approaches are probably quite complex, so I'd say polling is probably the best bet.
I can see two ways:
Your desktop application polls the web app
Your web app notifies the desktop application
Your web app could publish an RSS feed, but your desktop app will still have to poll the feed every 10 s.
The traffic need not be huge: if you use an HTTP HEAD request, you'll get a small packet with the date of the last modification (conveniently named Last-Modified).
I don't know exactly what to do to achieve your task but I can suggest to create a windows service at the desktop application PC.
This service checks the web application every interval of time for new changes and if changes occurred it can run the desktop application with notification that there is a change in the web application and in the web application when any change occurrs you can response with acknowledgment
I hope that this may be useful I didn't try it exactly but I am suggesting using like this idea.
A layer of syndication would help to scale out the system.
The desktop app can register itself with a "publisher" service (running on one of several/many machines) This publisher service receives the "notice" from your web app that something has changed, and immediately starts notifying all of its registered subscribers.
The number of publishers you need will increase with the number of users.
Edit: Forgot to mention that the desktop app will need to listen on a socket.