ADO pipeline "revert" - request

recently I created a pull request from Dev to Test environment and merged them in ADO Pipelines, and then after I need to make some changes and revert that pull request. But when I need to create a new pull request with a little more changes it shows no file difference between DEV and UAT.
Revert happened technically but branches show no changes. Please suggest what can be done to re-do or merge the changes in DEV to UAT?

Related

Sequelize returning old data from SQL Server

Problem: what I'm sometimes seeing is that very old data is being returned from my various databases when I do SELECT operations (findAll).
I have a VueJS app in which I'm using AxiosJS to call my backend ExpressJS app which uses Sequelize to connect to several (4) SQL Server databases. I'm also using the VueJS Developer Tools so I can see the variables and Vuex store change in real time on the frontend. I'm also using console.log on the backend so I can see some things there too.
In searching for solutions, I have found that:
I'm not using transactions; all of my queries are single queries that return results to the application, so I don't (shouldn't) have issues with commit timing; i.e. I UPDATE or ADD a row and only after it returns a result do I then make a SELECT
Sequelize keeps connections open, and so old connections show as "Sleeping" in the DB; I see these do get reused over time
I'm using the default isolation level in SQL Server which is READ COMMITTED and which should return committed data; since I'm waiting for the first query to return a result before launching the second query, shouldn't it be committed and ready to get me the latest values?
I see that SQL Server CAN store old copies of rows, sometimes making SNAPSHOTS, but I think they require higher isolation levels - but I'm not sure about that; maybe it IS keeping old versions?
I've been unsuccessful in figuring out how to close and reopen Sequelize connections. I'd like to close things at logout and reconnect there too since the app is still running in the tab (if this will solve my old data problem), thereby allowing someone to relogin and open all of the DB connections to be available again. I can't figure it out based on the available docs.
I think Sequelize is using old connections and somehow it is that which is causing SELECT results to be stale - this is even more likely if SQL Server is keeping old versions of rows
For some reason, if I logout and do a hard refresh of my app (CTRL+F5), all data is fresh; I don't understand why this would be at all. What could the browser be holding on to? Note that the console logs on the server app are always consistent with whatever the frontend shows. In other words, if the backend console log is stale, the frontend is stale; if backend is fresh, frontend is too.
I am unable to duplicate the getting of stale data using SSMS or Postman
Question: So what are the possible ways I can be getting stale data when I'm using Axios on the frontend and Sequelize on the backend?

Force updates on installed PWA when changing index.html (prevent caching)

I am building a react app, which consists in a Single Page Application, hosted on Amazon S3.
Sometimes, I deploy a change to the back-end and to the front-end at the same time, and I need all the browser sessions to start running the new version, or at least those whose sessions start after the last front-end deploy.
What happens is that many of my users still running the old front-end version on their phones for weeks, which is not compatible with the new version of the back-end anymore, but some of them get the updates by the time they start the next session.
As I use Webpack to build the app, it generates bundles with hashes in their names, while the index.html file, which defines the bundles that should be used, is uploaded with the following cache-control property: "no-cache, no-store, must-revalidate". The service worker file has the same cache policy.
The idea is that the user's browser can cache everything, execpt for the first files they need. The plan was good, but I'm replacing the index.html file with a newer version and my users are not refetching this file when they restart the app.
Is there a definitive guide or a way to workaround that problem?
I also know that a PWA should work offline, so it has to have the ability to cache to reuse, but this idea doesn't help me to perform a massive and instantaneous update as well, right?
What are the best options I have to do it?
You've got the basic idea correct. Why your index.html is not updated is a tough question to answer to since you're not providing any code – please include your Service Worker code. Keep in mind that depending on the logic implemented in the Service Worker, it doesn't necessarily honor the HTTP caching headers and will cache everything including the index.html file, as it seems now is happening.
In order to have the app work also in offline mode, you would probably want to use a network-first SW strategy. Using network-first the browser tries to load files from the web but if it doesn't succeed it falls back to the latest cached version of the particular file it tried to get. Another option would be to choose what is called a stale-while-revalidate strategy. That first gives the user the old file (which is super fast) and then updates the file in the background. There are other strategies as well, I suggest you read through the documentation of the most widely used SW library Workbox (https://developers.google.com/web/tools/workbox/modules/workbox-strategies).
One thing to keep in mind:
In all other strategies except "skip SW and go to the network", you cannot really ensure the user gets the latest version of the index.html. It is not possible. If the SW gives something back from the cache, it could be an old version and that's that. In these situations what is usually done is a notification to the user that a new version of the app has been donwloaded in the background. Basically user would load the app, see the version that was available in the cache, and SW would then check for updates. If an update was found (there was a new index.html and, because of that, new service-worker.js), the user would see a notification telling that the page should be refreshed. You can also trigger the SW to check for an update from the server manually from your own JS code if you want. In that situation, too, you would show a notification to the user.
Does this help you?

ReactJS production

How do you handle the refresh of the clients when used in production environment? What I'm looking for to achieve is to force the production client to reload with the new source code when pushing an update to the servers
On local, I'm using hot reload but it doesn't seem to be recommended in production.
To actually force a reload, you have a couple of options.
In broad strokes:
Your client script could poll your server via setInterval using a XHR request (fetch or XMLHTTPRequest object); then conditionally invoke a location.reload() if an update is available.
Alternatively, you could use a persistent connection like socket.io to push a reload command to your client in the background, invoking already-present reload-code in your client.
You might also consider keeping local application state in local storage so that the updated version can pick-up where the previous left-off.

Ratchet websocket responses do not change

I am using ratchet websockets to connect to a WAMP Autobahn front-end.
Everything works perfectly however when I change the topic code, the responses do not change!
i am running this in docker, when I restart the containers the updates responses get sent but then if I change this again nothing happens!
Your questions doesn't have many details but I think what is happening is your are running the PHP WebSocket server. Then changing the PHP code and expect the server to automatically update. That isn't how it works, you have to restart the websocket for code changes to take effect.
If you want to have a dynamic response without restarting the socket I suggest using a database or other data store that you can dynamically change and PHP can fetch from

Load data when webservices starts

i have a scenario where i have to load data from SQL server when i start running a web service. Later i have to use this data for my application, instead of accessing it every time from Database. In addition to this this data should be refreshed every one hour without affecting the website operation on the back end.If any of you has came across such scenario please let me know the solution. By the way i am using asp.net web services, SQL server database, and DNN for my front end.Thanks in advance.
In Global Asax,Application start event you can load all your data in the Dataset.
And by using Sql Cache dependency, You can refresh the data for each hour.But loading the
Entire data is not advisable.By making so you memory will be full.There will
be Performance degrade.
http://www.codeproject.com/Articles/14976/ASP-NET-Caching-Dependencies
Pre-loading all of your data is not a good practice because the database loses its purpose then. It’s probably ok for some data that is very rarely updated but needed very frequently but most definitely not for all the data you have in database.
As for the loading of data you can use app start event as others have already suggested.
Regarding caching – use Application object to make this data available to all parts of application and add a proprety to it that will keep the time of the last update. Then just create separate service that will check the last update time every X minutes and refresh the data when the time comes.

Resources