Rails Upgradation 6.1: AlgoliaJob is executing multiple times for all the associated records after upgrading rails

There is a X model and when updating information for a record AlgoliaJob is executed for only that school but after upgrading rails from 5.1.7 to 6.1.7 the AlgoliaJob is executing for all the records.

For this we using the below code:

algoliasearch per_environment: true, enqueue: true do
// list of attribute used to build an Algolia record

Note: because of enquqe true its running the algolia job which is reindexing the records