Erdogan is pretty much banking on "They'll never kick us out of NATO." They are dix. Fundamentally they're experiencing a currency crisis (the lira has lost 2/3rds of its value since 2016), a legitimacy crisis (the supposed coup attempt hasn't been resolved) and a border crisis (the Kurds and Rojavans refuse to die while the Syria-Turkey-Russia triangle just gets dumber and more expensive). This has led to all sorts of wild-eyed performative proxy warfare. It's a pigfuck.
Russia isn't into this, and I think that's why it will end soonish. It's the Caucuses, If Russia gets to swing it's dick anywhere it's here. They have good relations with both sides but seem to favor Armenia a bit. Azerbaijan has a bigger better military but the ground is a defenders dream. Anything the Azeris's take will be taken at a high cost and it will be a slow grind. I think Azerbaijan wanted to test the waters and see how all the players would react. If the Turks poke their heads into the conflict too much Russia will start applying pressure, either here or somewhere else. The Turks can't really afford too much additional pressure. This is my best guess of what's going on how things will go.