Skip to content

Commit

Permalink
PT-39170471 - current query for upsert allows duplicate records for t…
Browse files Browse the repository at this point in the history
…he same subscription. There is also a bug in getUnexpiredContactsFieldsContaining() where expired contacts are the ones returned.
  • Loading branch information
Joegen Baclor committed Nov 8, 2012
1 parent 8f93fe7 commit f1093d5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sipXcommserverLib/src/sipdb/SubscribeDB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ void SubscribeDB::upsert (
unsigned int version)
{
mongo::BSONObj query = BSON(
"key" << key.str() <<
"contact" << contact.str());
"toUri" << toUri.str() <<
"fromUri" << fromUri.str() <<
"callId" << callId.str() <<
"eventTypeKey" << eventTypeKey.str());

mongo::BSONObj update = BSON("$set" << BSON(
Subscription::component_fld() << component.str() <<
Expand Down Expand Up @@ -187,7 +189,7 @@ void SubscribeDB::getUnexpiredContactsFieldsContaining(
const int& timeNow,
std::vector<string>& matchingContactFields ) const
{
mongo::BSONObj query = BSON(Subscription::expires_fld() << BSON_LESS_THAN(timeNow));
mongo::BSONObj query = BSON(Subscription::expires_fld() << BSON_GREATER_THAN(timeNow));

mongo::ScopedDbConnection conn(_info.getConnectionString());
auto_ptr<mongo::DBClientCursor> pCursor = conn->query(_info.getNS(), query);
Expand Down

0 comments on commit f1093d5

Please sign in to comment.