content model sync during slot swap



We're using Azure App Service with slot deployments and experience unexpected behavior with content sync when swapping - old content version is being synced on top of latest content version.

EPiServer version: 11

Host Environment: Azure App Service (with slots)

Both Staging and Live slots use same databases, Staging has readOnly enabled using App service App settings

we are not using content versioning


both slots have app setting:     episerver:ReadOnlyConfigurationAPI - true 

on Staging: slot specific (sticky) Azure app service app setting:     episerver:DatabaseMode - ReadOnly

ReadOnly setting seems to be working - staging slot shows errors saying that DB is in ReadOnly mode. If app is restarted - content does not sync.

now during deployment:

we deploy to staging and trigger swap imediatelly.

Lets say current live slot (and epi model) has content with ModelType 'PageTypeOne'.

we deploy new version with new content 'PageTypeOne' and 'PageTypeTwo' to staging slot (ideally we would remove readOnly flag before deployment and add it afterwards to allow content to sync first time, but that's not relevant to the issue we're seeing so lets assume ReadOnly is always enabled on staging).

swap starts - live settings are applied to staging, readOnly flag removed, app restarts, content syncs and now contains both 'PageTypeOne' and 'PageTypeTwo'. (btw, we're validating using sql query: 

SELECT  *  FROM [tblContentType]  where ModelType LIKE '%PageTypeOne%' or ModelType LIKE '%PageTypeTwo%' )
all good until here. Now as a last step of the swap - staging settings are applied to what was previously live ( 'PageTypeOne'  only). Expected behavior is that ReadOnly flag is added, slot restarts, content DOES NOT sync, because DB is ReadOnly.
However - content DOES sync, and old content version is applied, causing errors on live site. staging is later set in readOnly mode, but we cannot avoid the sync during swap
Any suggestions on how to resolve this? we are using a standard Azure deploy and swap process, so I don't see what could be wrong there. maybe some more episerver settings are missing?
Any help is highly appreciated
Edited, Jun 10, 2021 9:05
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.