Skip to content

Conversation

NathanFlurry
Copy link
Member

Changes

Copy link

vercel bot commented Aug 9, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rivet-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 9, 2025 1:47am

Copy link
Contributor

graphite-app bot commented Aug 9, 2025

Merge activity

  • Aug 9, 1:38 AM UTC: NathanFlurry added this pull request to the Graphite merge queue.
  • Aug 9, 1:38 AM UTC: CI is running for this pull request on a draft pull request (#2844) due to your merge queue CI optimization settings.
  • Aug 9, 1:39 AM UTC: Merged by the Graphite merge queue via draft PR: #2844.

Copy link

claude bot commented Aug 9, 2025

Claude encountered an error —— View job


I'll analyze this and get back to you.

Copy link
Member Author

NathanFlurry commented Aug 9, 2025


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

graphite-app bot pushed a commit that referenced this pull request Aug 9, 2025
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
@graphite-app graphite-app bot closed this Aug 9, 2025
@graphite-app graphite-app bot deleted the feat_add_driver_context_access_in_createVars_function branch August 9, 2025 01:39
Comment on lines +4043 to +4067
const myActor = actor(,

// Access Redis connection through driver context
createVars: (ctx, driver: DriverContext) => ;
},

actions: `, value, 'EX', 3600);

// Also store locally for fast access
c.vars.cacheData.set(key, value);

return "Cached successfully";
},

// Example: Get cached value
getCachedValue: async (c, key: string) =>

// Fallback to Redis
const value = await c.vars.redis.get(`cache:$`);
if (value)

return value;
}
}
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Redis example code contains several syntax errors and incomplete sections:

  1. The actor() function is missing its first parameter (likely an object with configuration)
  2. The createVars function has an incomplete return statement
  3. The Redis set operation is missing its beginning (likely c.vars.redis.set)
  4. String interpolation in the Redis key is malformed - cache:$ should be cache:${key}
  5. The conditional after checking the Redis value is incomplete

These issues would prevent the example from working as intended. Consider providing a complete, syntactically correct example to demonstrate the Redis driver context functionality.

Suggested change
const myActor = actor(,
// Access Redis connection through driver context
createVars: (ctx, driver: DriverContext) => ;
},
actions: `, value, 'EX', 3600);
// Also store locally for fast access
c.vars.cacheData.set(key, value);
return "Cached successfully";
},
// Example: Get cached value
getCachedValue: async (c, key: string) =>
// Fallback to Redis
const value = await c.vars.redis.get(`cache:$`);
if (value)
return value;
}
}
});
const myActor = actor({
name: 'CacheActor',
}, {
// Access Redis connection through driver context
createVars: (ctx, driver: DriverContext) => {
return {
redis: driver.redis,
cacheData: new Map()
};
},
actions: {
// Example: Cache a value
cacheValue: async (c, key: string, value: string) => {
// Store in Redis with 1 hour expiration
await c.vars.redis.set(`cache:${key}`, value, 'EX', 3600);
// Also store locally for fast access
c.vars.cacheData.set(key, value);
return "Cached successfully";
},
// Example: Get cached value
getCachedValue: async (c, key: string) => {
// Try local cache first
const localValue = c.vars.cacheData.get(key);
if (localValue) return localValue;
// Fallback to Redis
const value = await c.vars.redis.get(`cache:${key}`);
if (value) {
// Update local cache
c.vars.cacheData.set(key, value);
}
return value;
}
}
});

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +192 to +195
kvGet: (c, key: string) => {
const doState = c.vars.state;
return await doState.storage.get(key)
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The kvGet function is using await but is not declared as async. This will cause a syntax error. The function signature should be updated to:

kvGet: async (c, key: string) => {
  const doState = c.vars.state;
  return await doState.storage.get(key);
}
Suggested change
kvGet: (c, key: string) => {
const doState = c.vars.state;
return await doState.storage.get(key)
},
kvGet: async (c, key: string) => {
const doState = c.vars.state;
return await doState.storage.get(key)
},

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant