Simulating a background task in AppHarbor

I use System.Runtime.Caching.MemoryCache to simulate a recurring task in a running .NET MVC application deployed to AppHarbor.

Entries in the cache are added using CacheItemPolicy, which contains the offset AbsoluteExpiration and RemovedCallback, which calls the method and repeats adding the item to the cache (as described here )

MemoryCache is logged for the first time in Application_Start. It works fine locally, but doesn't seem to work after deployment in AppHarbor (also used with HttpRuntime.Cache, same result).

My application runs under the CANOE (free) account in AppHarbor, which has only one worker. Does this mean that I can not simulate a background task until I switch to some kind of paid plan?

Thanks!

+6
source share
2 answers

Your application must have visitors from time to time for this to work. Besides "StillAlive", Pingdom is also a good bet for generating requests for your application. You should also take a look at MomentApp . We expect that background tasks will be ready in the near future.

+4
source

I don’t think the update will help, they are working on adding background jobs to AppHarbor, but as far as I know, they are available.

How about using a service like https://stillalive.com/ to periodically visit a page on your site that then spins a new thread and launches your background task? It is available as a free add-on.

I was thinking of doing something similar, waiting for the functionality of the background task to be available.

0
source

Source: https://habr.com/ru/post/907670/


All Articles