|  | @@ -217,7 +217,7 @@ NSOperationQueue *taskQueue;
 | 
	
		
			
			| 217 | 217 |  
 | 
	
		
			
			| 218 | 218 |      // #115 handling task expired when application entering backgound for a long time
 | 
	
		
			
			| 219 | 219 |      [app beginBackgroundTaskWithName:taskId expirationHandler:^{
 | 
	
		
			
			| 220 |  | -        NSLog([NSString stringWithFormat:@"session %@ expired event emit", taskId ]);
 | 
	
		
			
			|  | 220 | +        NSLog([NSString stringWithFormat:@"session %@ expired", taskId ]);
 | 
	
		
			
			| 221 | 221 |          [expirationTable setObject:task forKey:taskId];
 | 
	
		
			
			| 222 | 222 |          [app endBackgroundTask:task];
 | 
	
		
			
			| 223 | 223 |  
 | 
	
	
		
			
			|  | @@ -227,7 +227,7 @@ NSOperationQueue *taskQueue;
 | 
	
		
			
			| 227 | 227 |  }
 | 
	
		
			
			| 228 | 228 |  
 | 
	
		
			
			| 229 | 229 |  // #115 Invoke fetch.expire event on those expired requests so that the expired event can be handled
 | 
	
		
			
			| 230 |  | -+ (void) getExpiredTasks
 | 
	
		
			
			|  | 230 | ++ (void) emitExpiredTasks
 | 
	
		
			
			| 231 | 231 |  {
 | 
	
		
			
			| 232 | 232 |      NSEnumerator * emu =  [expirationTable keyEnumerator];
 | 
	
		
			
			| 233 | 233 |      NSString * key;
 | 
	
	
		
			
			|  | @@ -238,6 +238,9 @@ NSOperationQueue *taskQueue;
 | 
	
		
			
			| 238 | 238 |          NSData * args = @{ @"taskId": key };
 | 
	
		
			
			| 239 | 239 |          [bridge.eventDispatcher sendDeviceEventWithName:EVENT_EXPIRE body:args];
 | 
	
		
			
			| 240 | 240 |      }
 | 
	
		
			
			|  | 241 | +    
 | 
	
		
			
			|  | 242 | +    // emit expired event once
 | 
	
		
			
			|  | 243 | +    [expirationTable removeAllObjects];
 | 
	
		
			
			| 241 | 244 |  }
 | 
	
		
			
			| 242 | 245 |  
 | 
	
		
			
			| 243 | 246 |  ////////////////////////////////////////
 |