Code

Opened 7 years ago

Closed 7 years ago

#5310 closed (invalid)

sync database between two processes dynamically

Reported by: wanyancan@… Owned by: adrian
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

if two independent processes access the same model, how to make the second process see the result immediately taken by the first process's model.save()?
I've tested multiple threads in a single process, there's no such problem.
But when with two processes, I tested with the following steps:

  1. in process one:

    Pkg.objects.all().count()

4

  1. in process two:

    p = Pkg(name='hi'); p.save()

  2. in process two:

    Pkg.objects.all().count()

5

  1. in process one:

    Pkg.objects.all().count()

4

Here's the question: How to re-retrieve the objects from the database?

Attachments (0)

Change History (2)

comment:1 in reply to: ↑ description Changed 7 years ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Replying to wanyancan@gmail.com:
Sorry for the wrong format, here's the steps I've tested

1. in process one: 
>>> Pkg.objects.all().count()
4
2. in process two:
>>> p = Pkg(name='hi'); p.save()
3. in process two:
>>> Pkg.objects.all().count()
5
4. in process one:
>>> Pkg.objects.all().count()
4
^^

comment:2 Changed 7 years ago by russellm

  • Resolution set to invalid
  • Status changed from new to closed

Please ask support questions on the django-users mailing list. The ticket tracker is for tracking bugs that need to be fixed.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.