* Process a pending asynchronous request. */
| 7178 | * Process a pending asynchronous request. |
| 7179 | */ |
| 7180 | void |
| 7181 | process_pending_request(AsyncRequest *areq) |
| 7182 | { |
| 7183 | ForeignScanState *node = (ForeignScanState *) areq->requestee; |
| 7184 | PgFdwScanState *fsstate PG_USED_FOR_ASSERTS_ONLY = (PgFdwScanState *) node->fdw_state; |
| 7185 | |
| 7186 | /* The request would have been pending for a callback */ |
| 7187 | Assert(areq->callback_pending); |
| 7188 | |
| 7189 | /* The request should be currently in-process */ |
| 7190 | Assert(fsstate->conn_state->pendingAreq == areq); |
| 7191 | |
| 7192 | fetch_more_data(node); |
| 7193 | |
| 7194 | /* |
| 7195 | * If we didn't get any tuples, must be end of data; complete the request |
| 7196 | * now. Otherwise, we postpone completing the request until we are called |
| 7197 | * from postgresForeignAsyncConfigureWait()/postgresForeignAsyncNotify(). |
| 7198 | */ |
| 7199 | if (fsstate->next_tuple >= fsstate->num_tuples) |
| 7200 | { |
| 7201 | /* Unlike AsyncNotify, we unset callback_pending ourselves */ |
| 7202 | areq->callback_pending = false; |
| 7203 | /* Mark the request as complete */ |
| 7204 | ExecAsyncRequestDone(areq, NULL); |
| 7205 | /* Unlike AsyncNotify, we call ExecAsyncResponse ourselves */ |
| 7206 | ExecAsyncResponse(areq); |
| 7207 | } |
| 7208 | } |
| 7209 | |
| 7210 | /* |
| 7211 | * Complete a pending asynchronous request. |
no test coverage detected