cleanup: move db access into doInBackground()

This commit is contained in:
Eric House 2018-01-29 19:29:18 -08:00
parent 5326d42438
commit 757c5b4ece

View file

@ -485,9 +485,7 @@ public class GameUtils {
}
if ( force ) {
HashMap<Long,CommsConnTypeSet> games =
DBUtils.getGamesWithSendsPending( context );
new ResendTask( context, games, filter, proc ).execute();
new ResendTask( context, filter, proc ).execute();
System.arraycopy( sendTimes, 0, /* src */
sendTimes, 1, /* dest */
@ -1264,11 +1262,10 @@ public class GameUtils {
private CommsConnType m_filter;
private int m_nSent = 0;
public ResendTask( Context context, HashMap<Long,CommsConnTypeSet> games,
CommsConnType filter, ResendDoneProc proc )
public ResendTask( Context context, CommsConnType filter,
ResendDoneProc proc )
{
m_context = context;
m_games = games;
m_filter = filter;
m_doneProc = proc;
}
@ -1276,6 +1273,8 @@ public class GameUtils {
@Override
protected Void doInBackground( Void... unused )
{
m_games = DBUtils.getGamesWithSendsPending( m_context );
Iterator<Long> iter = m_games.keySet().iterator();
while ( iter.hasNext() ) {
long rowid = iter.next();