Subversion Repositories SmartDukaan

Rev

Rev 17228 | Rev 17235 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17228 Rev 17229
Line 195... Line 195...
195
        if notificationRec.get('notification_campaign_id') not in campaignIdList:
195
        if notificationRec.get('notification_campaign_id') not in campaignIdList:
196
            campaignIdList.append(notificationRec.get('notification_campaign_id'))
196
            campaignIdList.append(notificationRec.get('notification_campaign_id'))
197
    
197
    
198
    usersList.append(0)
198
    usersList.append(0)
199
    campaignIdList.append(0)
199
    campaignIdList.append(0)
200
        
-
 
201
    cursor.execute(GCM_REG_ID_SQL%(str(tuple(usersList))))
-
 
202
    result_data = cursor.fetchall()
-
 
203
    
200
    
204
    for dataRec in result_data:
201
    if len(usersList) >1 and len(campaignIdList)>1:
-
 
202
        cursor.execute(GCM_REG_ID_SQL%(str(tuple(usersList))))
205
        userGcmRegIdMap[dataRec[0]] = dataRec[1]
203
        result_data = cursor.fetchall()
206
        
204
        
-
 
205
        for dataRec in result_data:
-
 
206
            userGcmRegIdMap[dataRec[0]] = dataRec[1]
-
 
207
            
207
    cursor.execute(CAMPAIGNS_SQL%(str(tuple(campaignIdList))))
208
        cursor.execute(CAMPAIGNS_SQL%(str(tuple(campaignIdList))))
208
    campaign_data = cursor.fetchall()
209
        campaign_data = cursor.fetchall()
209
    
210
        
210
    for campaignRec in campaign_data:
211
        for campaignRec in campaign_data:
211
        campaignsMap[campaignRec[0]] = campaignRec    
212
            campaignsMap[campaignRec[0]] = campaignRec    
212
    
213
        
213
    count = 1
214
        count = 1
214
    if result_data:
215
        if result_data:
215
        campaign_receivers_list = list(chunks(notificationListJson, options.chunksize))
216
            campaign_receivers_list = list(chunks(notificationListJson, options.chunksize))
216
        print len(campaign_receivers_list)
217
            print len(campaign_receivers_list)
217
        for sublist in campaign_receivers_list:
218
            for sublist in campaign_receivers_list:
218
            thread = NotificationThread(count, "Thread-"+str(count), sublist)
219
                thread = NotificationThread(count, "Thread-"+str(count), sublist)
219
            thread.start()
220
                thread.start()
220
            count = count +1
221
                count = count +1
221
            
222
            
222
    db.close()
223
    db.close()
223
    if session.is_active:
-
 
224
        print "session is active. closing it."
-
 
225
        session.close()    
-
 
226
 
224
 
227
if __name__=='__main__':
225
if __name__=='__main__':
228
    main()
226
    main()
229
    
227
    
230
228