Closed Bug 1301867 Opened 8 years ago Closed 6 years ago

Moving Article does not work in development Environment

Categories

(developer.mozilla.org Graveyard :: Wiki pages, defect)

All
Other
defect
Not set
minor

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: safwan, Unassigned)

References

Details

(Keywords: in-triage, Whiteboard: [specification][type:bug])

What did you do?
================
1) Create https://developer-local.allizom.org/en-US/docs/MoveTest Article
2) Select "Move this Article"
3. Select "MoveTestNew" for the new slug.
4. It says "Page Move Scheduled", and that it will email you on completion.

What happened?
==============
The Article is not moved to the MoveTestNew and no email has been created.
In production/stage, it works. But in development Environment, it does not

What should have happened?
==========================
The Article should be moved to the new slug

Is there anything else we should know?
======================================
So I have debugged through the issue. It seems that, the developer environment has "CELERY_ALWAYS_EAGER = True". According to the documentation(1), it seems that enabling this option is a good practice in developer environment so that all the task will run synchronously not asynchronously. So the developer does not need to wait for the task to run in que.

But, this lead the problem, If this option is disabled aka "CELERY_ALWAYS_EAGER = False", the page moves works like production. 

So we need to find a way so that it will also work while the task is synchronous.

The code lies in: https://github.com/mozilla/kuma/blob/552f6508da8a4854ccbcc9ef02fd1e9d54934b5a/kuma/wiki/tasks.py#L144

1. http://docs.celeryproject.org/en/latest/configuration.html#celery-always-eager
See Also: → 1292624
Severity: normal → minor
Keywords: in-triage
"Minor" because only fixing "must fix" bugs in the Vagrant environment. We'll make this work in the Dockerized development environment, then deprecate and remove Vagrant.
See Also: → 1218563
(In reply to John Whitlock [:jwhitlock] from comment #1)
> "Minor" because only fixing "must fix" bugs in the Vagrant environment.
> We'll make this work in the Dockerized development environment, then
> deprecate and remove Vagrant.

Its not about vagrant or docker environment issue. Its more likely a issue in django developer environment. So therefore I dont think it will affect whether we move to docker.
I think it's an issue with the way the task is written - it works as a async task (CELERY_ALWAYS_EAGER=False), but not as a sync task (CELERY_ALWAYS_EAGER=True). This may be a reason that there appear to be little or no tests of the functionality - CELERY_ALWAYS_EAGER=True is the test default.

If I'm correct, the fastest way to get this working in a development environment is to construct the Docker development environment with a celery worker and CELERY_ALWAYS_EAGER=False as the default.  That would solve the bug as written ("Moving Article does not work in development Environment"), but leave the problem of making this code testable. It really needs a re-write.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.