Background tasks on idle tenants appear to repeatedly fail if there is a pending migration

Topics: Core, General, Troubleshooting
Apr 8, 2014 at 10:45 AM
We recently had a situation where our logs were flooded with NHibernate exceptions (missing columns etc...).

After a bit of tracking down, we realised that what had appeared to happen was that a tenant who gets no traffic had a pending Data Migration that had not run. This tenant was executing a background task every minute, which was failing because the pending Data Migrations had not yet run.

Can anyone confirm when Data Migrations are meant to run? Is it when an admin logs in? When a page is requested? Or some other time?

Should a background task trigger a migration?
Apr 8, 2014 at 3:23 PM
Migrations are run through ProcessingEngine that executes code asynchronously after requests. Thus migrations run on the first request to the site. What you see is therefore expected, although probably not ideal. A workaround for now is to ping all of your tenants when starting the app, what is not a bad idea to warm up all the sites anyway.