# Help to close large statement

**URL:** https://discuss.tryton.org/t/help-to-close-large-statement/6036
**Category:** Developer
**Created:** [March 22, 2023, 2:14pm UTC](https://discuss.tryton.org/t/help-to-close-large-statement/6036 "2023-03-22T14:14:01Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![iehoshia](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/iehoshia/32/243_2.png) [@iehoshia](https://discuss.tryton.org/u/iehoshia)
#### Post date: [March 22, 2023, 2:14pm UTC](https://discuss.tryton.org/t/help-to-close-large-statement/6036/1 "2023-03-22T14:14:02Z")

</div>

Hi,

I need to close a large statement (1665 lines) each line related to a invoice, but after a few minuts I receive this message:

```auto
File "/usr/lib/python3.9/xmlrpc/client.py", line 1116, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python3.9/xmlrpc/client.py", line 1456, in __request
    response = self.__transport.request(
  File "/usr/lib/python3.9/xmlrpc/client.py", line 1160, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/usr/lib/python3.9/xmlrpc/client.py", line 1173, in single_request
    resp = http_conn.getresponse()
  File "/usr/lib/python3.9/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/lib/python3.9/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.9/http/client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

```

I think it is a configuration trouble or with resources. I’m using uwsgi but not sure how to add more resources (if it is neccesary).

Thanks in advance!

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [March 22, 2023, 2:51pm UTC](https://discuss.tryton.org/t/help-to-close-large-statement/6036/2 "2023-03-22T14:51:28Z")

</div>

This sounds like a problem with a proxy on front of Tryton, the tryton server should continue running without problem.

Posting an statment is a large process as it recomputes the state of all sales and purchases related to invoces.

IIRC this was improved on 6.2 series, so if you are using an older version you may consider upgrading to it.

Also you can use a task queue to recompute the sales/purchase state is done in the background and the request does not take so time.

Hope it helps

---

<div class="post-metadata">

### Author: ![iehoshia](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/iehoshia/32/243_2.png) [@iehoshia](https://discuss.tryton.org/u/iehoshia)
#### Post date: [March 22, 2023, 3:11pm UTC](https://discuss.tryton.org/t/help-to-close-large-statement/6036/3 "2023-03-22T15:11:09Z")

</div>

Thanks for the info,

I’m not using proxy in front of Tryton.

I’m using 6.2.14 but not I don’t know how to use IIRC.

Also, not sure how to use queue, I only configure [queue] section in tryton.conf but don’t know if need to do something else.

```auto
[queue]
queue_name = sale
queue_batch = 10

```

Thanks for the help.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [March 22, 2023, 3:31pm UTC](https://discuss.tryton.org/t/help-to-close-large-statement/6036/4 "2023-03-22T15:31:31Z")

</div>

> [@iehoshia](#):
>
> Also, not sure how to use queue, I only configure [queue] section in tryton.conf but don’t know if need to do something else.
> 
> ```auto
> [queue]
> queue_name = sale
> queue_batch = 10
> 
> ```

You need to run `tryton-worker` in a separate step

---

<div class="post-metadata">

### Author: ![iehoshia](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/iehoshia/32/243_2.png) [@iehoshia](https://discuss.tryton.org/u/iehoshia)
#### Post date: [March 22, 2023, 3:39pm UTC](https://discuss.tryton.org/t/help-to-close-large-statement/6036/5 "2023-03-22T15:39:15Z")

</div>

Do I only need to run the script?

I did it but without a response or message.

---

<div class="post-metadata">

### Author: ![pokoli](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/pokoli/32/22_2.png) [@pokoli](https://discuss.tryton.org/u/pokoli)
#### Post date: [March 22, 2023, 4:18pm UTC](https://discuss.tryton.org/t/help-to-close-large-statement/6036/6 "2023-03-22T16:18:58Z")

</div>

You need to run the script and it will pick tasks once they are posted.  
So when you post the statement, the tasks will be run on the worker instead of on the main trytond process.
