# segment update cron removing and adding contacts!

**URL:** <https://forum.mautic.org/t/segment-update-cron-removing-and-adding-contacts/5139>\
**Category:** Product Support\
**Created:** [August 31, 2016, 5:30pm UTC](https://forum.mautic.org/t/segment-update-cron-removing-and-adding-contacts/5139 "2016-08-31T17:30:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![fcatanza](https://avatars.discourse-cdn.com/v4/letter/f/45deac/32.png) [@fcatanza](https://forum.mautic.org/u/fcatanza)\
**Post date:** [August 31, 2016, 5:30pm UTC](https://forum.mautic.org/t/segment-update-cron-removing-and-adding-contacts/5139/1 "2016-08-31T17:30:10Z")

</div>

I have 2.1.1 and the crons setup staggered every 15 minutes, etc.  
  
  
  
I have a segment which is based on “visiting a URL”. After I create the segment, people got added to it correctly.  
  
Then after a little while, the cron segment:update REMOVES THOSE PEOPLE.  
  
Then after a little while, the cron segment:update ADDS THE PEOPLE AGAIN?  
  
  
  
It seems Mautic is incorrectly disqualifying contacts from a segment and removes them. Then when it runs again it realizes  
  
that the people belong in the segment and re-adds them.  
  
This is wreaking havoc with a campaign that is triggered by the people being added to the segment!!!  
  
  
  
I suspect there is some error in how it judges someone no longer belongs in the segment and/or is timing out.  
  
The thing is, if I run in in a console, segment:update is pretty quick and I allow plenty of time to finish.  
  
  
  
Can someone help? This has been happening since 2.0 and I was hoping it was fixed, but it is not.  
  
Here is an example output:  
  
  
  
Rebuilding contacts for segment 21  
  
852 total contact(s) to be added in batches of 300  
  
0/852 [\>---------------------------] 0%  
  
85/852 [==\>-------------------------] 9%  
  
170/852 [=====\>----------------------] 19%  
  
255/852 [========\>-------------------] 29%  
  
340/852 [===========\>----------------] 39%  
  
425/852 [=============\>--------------] 49%  
  
510/852 [================\>-----------] 59%  
  
595/852 [===================\>--------] 69%  
  
680/852 [======================\>-----] 79%  
  
765/852 [=========================\>–] 89%  
  
850/852 [===========================\>] 99%  
  
852/852 [============================] 100%  
  
0 total contact(s) to be removed in batches of 300  
  
852 contact(s) affected  
  
  
  
The above runs in undcer 1 minute. Then 15 minutes later:  
  
Rebuilding contacts for segment 21  
  
2 total contact(s) to be added in batches of 300  
  
0/2 [\>---------------------------] 0%  
  
1/2 [==============\>-------------] 50%  
  
2/2 [============================] 100%  
  
501 total contact(s) to be removed in batches of 300  
  
0/501 [\>---------------------------] 0%  
  
50/501 [==\>-------------------------] 9%  
  
100/501 [=====\>----------------------] 19%  
  
150/501 [========\>-------------------] 29%  
  
200/501 [===========\>----------------] 39%  
  
250/501 [=============\>--------------] 49%  
  
300/501 [================\>-----------] 59%  
  
350/501 [===================\>--------] 69%  
  
400/501 [======================\>-----] 79%  
  
450/501 [=========================\>–] 89%  
  
500/501 [===========================\>] 99%  
  
501/501 [============================] 100%  
  
503 contact(s) affected

---

<div class="post-metadata">

**Author:** ![fcatanza](https://avatars.discourse-cdn.com/v4/letter/f/45deac/32.png) [@fcatanza](https://forum.mautic.org/u/fcatanza)\
**Post date:** [August 31, 2016, 5:30pm UTC](https://forum.mautic.org/t/segment-update-cron-removing-and-adding-contacts/5139/2 "2016-08-31T17:30:10Z")

</div>

I have 2.1.1 and the crons setup staggered every 15 minutes, etc.

I have a segment which is based on “visiting a URL”. After I create the segment, people got added to it correctly.  
Then after a little while, the cron segment:update REMOVES THOSE PEOPLE.  
Then after a little while, the cron segment:update ADDS THE PEOPLE AGAIN?

It seems Mautic is incorrectly disqualifying contacts from a segment and removes them. Then when it runs again it realizes  
that the people belong in the segment and re-adds them.  
This is wreaking havoc with a campaign that is triggered by the people being added to the segment!!!

I suspect there is some error in how it judges someone no longer belongs in the segment and/or is timing out.  
The thing is, if I run in in a console, segment:update is pretty quick and I allow plenty of time to finish.

Can someone help? This has been happening since 2.0 and I was hoping it was fixed, but it is not.  
Here is an example output:

Rebuilding contacts for segment 21  
852 total contact(s) to be added in batches of 300  
0/852 [\>---------------------------] 0%  
85/852 [==\>-------------------------] 9%  
170/852 [=====\>----------------------] 19%  
255/852 [========\>-------------------] 29%  
340/852 [===========\>----------------] 39%  
425/852 [=============\>--------------] 49%  
510/852 [================\>-----------] 59%  
595/852 [===================\>--------] 69%  
680/852 [======================\>-----] 79%  
765/852 [=========================\>–] 89%  
850/852 [===========================\>] 99%  
852/852 [============================] 100%  
0 total contact(s) to be removed in batches of 300  
852 contact(s) affected

The above runs in undcer 1 minute. Then 15 minutes later:  
Rebuilding contacts for segment 21  
2 total contact(s) to be added in batches of 300  
0/2 [\>---------------------------] 0%  
1/2 [==============\>-------------] 50%  
2/2 [============================] 100%  
501 total contact(s) to be removed in batches of 300  
0/501 [\>---------------------------] 0%  
50/501 [==\>-------------------------] 9%  
100/501 [=====\>----------------------] 19%  
150/501 [========\>-------------------] 29%  
200/501 [===========\>----------------] 39%  
250/501 [=============\>--------------] 49%  
300/501 [================\>-----------] 59%  
350/501 [===================\>--------] 69%  
400/501 [======================\>-----] 79%  
450/501 [=========================\>–] 89%  
500/501 [===========================\>] 99%  
501/501 [============================] 100%  
503 contact(s) affected

---

<div class="post-metadata">

**Author:** ![coh998](https://avatars.discourse-cdn.com/v4/letter/c/fbc32d/32.png) [@coh998](https://forum.mautic.org/u/coh998)\
**Post date:** [October 31, 2016, 12:25pm UTC](https://forum.mautic.org/t/segment-update-cron-removing-and-adding-contacts/5139/3 "2016-10-31T12:25:40Z")

</div>

I have a similar problem, and it’s quite serious. Update Segments cron runs twice a day, once at midnight and once at 06:00. The midnight run is removing X number of contacts from the unsubscribe segment, then the morning run is adding same X number back in. Why is Update Segments _ever_ removing _any_ contacts from the _Unsubscribe_ segment for any reason?!
