Repository: doccano/doccano

Issue:
Doccano is not importing any text data
Hello,

Doccano is not importing any text data. When importing the text data the following browser loading is going on:
![image](https://user-images.githubusercontent.com/54842807/161327838-33b120e9-428c-4ade-92c2-f5ac7c9fce5d.png)

The command line terminal is showing the following:-
```
<Starting server with port 8000.
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 2
Bad Request: /v1/auth/login/
WARNING:django.request:Bad Request: /v1/auth/login/
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 2
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1
WARNING:waitress.queue:Task queue depth is 1>
```

Your Environment
---------
*   Operating System: Windows 10
*   Python Version Used: 3.10
*   When you install doccano: Few days back
*   How did you install doccano (Heroku button etc): Command Line



Discussion:
Related to:

- [How to find the cause of "task queue depth" warnings from waitress?](https://stackoverflow.com/questions/55857058/how-to-find-the-cause-of-task-queue-depth-warnings-from-waitress)

Currently, we can't pass the number of workers to the server. We need to change the code to pass `threads=args.workers`.

- [Arguments to waitress.serve](https://docs.pylonsproject.org/projects/waitress/en/stable/arguments.html)
https://github.com/doccano/doccano/blob/350bc5e95fa459d1dc124a320cb8e34385b73021/backend/cli.py#L62-L67
Facing the same issue. May I know how to tackle this? Or do I just need to wait until the developers end to fix the bug? @Hironsan 
The following may solve the problem:
https://github.com/doccano/doccano/issues/1762#issuecomment-1087141902

Unfortunately, I can't reproduce this problem.
> The following may solve the problem: [#1762 (comment)](https://github.com/doccano/doccano/issues/1762#issuecomment-1087141902)
> 
> Unfortunately, I can't reproduce this problem.

Where should I paste the code? My Doccano folder don't have cli.py
![image](https://user-images.githubusercontent.com/56106630/163527888-82f47d93-1e73-47c5-9f1b-cbea9fec784b.png)


```bash
> which doccano
/venv/bin/doccano
> ls /venv/lib/python3.8/site-packages/backend/cli.py
```
Do you mean paste the code above at `cli.py`?  Which line should i insert `threads=args.workers`?
![image](https://user-images.githubusercontent.com/56106630/163539115-879060b8-047f-492c-bbc4-d0dc3cfd7db3.png)

This line:

```python
serve(application, port=args.port, threads=args.workers)
```
> This line:
> 
> ```python
> serve(application, port=args.port, threads=args.workers)
> ```

I've altered & saved the code. But did not solve the loading issue.
![image](https://user-images.githubusercontent.com/56106630/163739301-aeec61ea-0507-413b-86c4-dbc4d08d7e58.png)

Can you increase the number of workers?

```bash
doccano webserver --workers=8
```
> Can you increase the number of workers?
> 
> ```shell
> doccano webserver --workers=8
> ```

Yup, have increased it. But the issue still persisted. BTW, is it normal there is no updates on the command prompt when running Doccano?
![image](https://user-images.githubusercontent.com/56106630/163744948-3d7c2a32-0468-4e98-8d2a-4ded22aad576.png)

> BTW, is it normal there is no updates on the command prompt when running Doccano?

Yes, because the worker is not printed.

By the way, did you run the `doccano task` command?
- [Install with pip](https://doccano.github.io/doccano/install-and-upgrade-doccano/#install-with-pip)
> > BTW, is it normal there is no updates on the command prompt when running Doccano?
> 
> Yes, because the worker is not printed.
> 
> By the way, did you run the `doccano task` command?
> 
> * [Install with pip](https://doccano.github.io/doccano/install-and-upgrade-doccano/#install-with-pip)

No, I didn't. I just run it after you told me. And now everything seems work perfectly! Thank youu!
Good! your welcome.

Resolving patch:
diff --git a/backend/cli.py b/backend/cli.py
--- a/backend/cli.py
+++ b/backend/cli.py
@@ -66,7 +66,7 @@ def run_on_windows(args):
 
     from config.wsgi import application
 
-    serve(application, port=args.port)
+    serve(application, port=args.port, threads=args.workers)
 
 
 def command_db_init(args):


Test patch:
diff --git a/frontend/test/unit/components/tasks/toolbar/forms/formGuideline.spec.js b/frontend/test/unit/components/tasks/toolbar/forms/formGuideline.spec.js
--- a/frontend/test/unit/components/tasks/toolbar/forms/formGuideline.spec.js
+++ b/frontend/test/unit/components/tasks/toolbar/forms/formGuideline.spec.js
@@ -11,7 +11,7 @@ const factory = () => {
     propsData: {
       guidelineText: 'Hello'
     },
-    mocks:{ $t }
+    mocks: { $t }
   })
 }