Skip to content

Commit 4e70232

Browse files
authored
Fix python syntax in README examples (#34)
1 parent 15eccfc commit 4e70232

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ insert_res = client.insert(
6565
insert_opts=riverqueue.InsertOpts(
6666
max_attempts=17,
6767
priority=3,
68-
queue: "my_queue",
69-
tags: ["custom"]
68+
queue="my_queue",
69+
tags=["custom"]
7070
),
7171
)
7272
```
@@ -80,10 +80,10 @@ insert_res = client.insert(
8080
SortArgs(strings=["whale", "tiger", "bear"]),
8181
insert_opts=riverqueue.InsertOpts(
8282
unique_opts=riverqueue.UniqueOpts(
83-
by_args: True,
83+
by_args=True,
8484
by_period=15*60,
85-
by_queue: True,
86-
by_state: [riverqueue.JobState.AVAILABLE]
85+
by_queue=True,
86+
by_state=[riverqueue.JobState.AVAILABLE]
8787
)
8888
),
8989
)
@@ -100,7 +100,7 @@ insert_res.unique_skipped_as_duplicated
100100
Unique job insertion takes a Postgres advisory lock to make sure that its uniqueness check still works even if two conflicting insert operations are occurring in parallel. Postgres advisory locks share a global 64-bit namespace, which is a large enough space that it's unlikely for two advisory locks to ever conflict, but to _guarantee_ that River's advisory locks never interfere with an application's, River can be configured with a 32-bit advisory lock prefix which it will use for all its locks:
101101

102102
```python
103-
client = riverqueue.Client(riversqlalchemy.Driver(engine), advisory_lock_prefix: 123456)
103+
client = riverqueue.Client(riversqlalchemy.Driver(engine), advisory_lock_prefix=123456)
104104
```
105105

106106
Doing so has the downside of leaving only 32 bits for River's locks (64 bits total - 32-bit prefix), making them somewhat more likely to conflict with each other.
@@ -111,17 +111,17 @@ Use `#insert_many` to bulk insert jobs as a single operation for improved effici
111111

112112
```python
113113
num_inserted = client.insert_many([
114-
SimpleArgs(job_num: 1),
115-
SimpleArgs(job_num: 2)
114+
SimpleArgs(job_num=1),
115+
SimpleArgs(job_num=2)
116116
])
117117
```
118118

119119
Or with `InsertManyParams`, which may include insertion options:
120120

121121
```python
122122
num_inserted = client.insert_many([
123-
InsertManyParams(args=SimpleArgs.new(job_num: 1), insert_opts=riverqueue.InsertOpts.new(max_attempts=5)),
124-
InsertManyParams(args=SimpleArgs.new(job_num: 2), insert_opts=riverqueue.InsertOpts.new(queue="high_priority"))
123+
InsertManyParams(args=SimpleArgs(job_num=1), insert_opts=riverqueue.InsertOpts(max_attempts=5)),
124+
InsertManyParams(args=SimpleArgs(job_num=2), insert_opts=riverqueue.InsertOpts(queue="high_priority"))
125125
])
126126
```
127127

0 commit comments

Comments
 (0)